效果图:

VBS 十六进制异或加密实现代码

代码都封装成函数了,方便调用:

复制代码 代码如下:
Key = "www-enun-net" '不要用数字

Wscript.echo now & ", 加密: "
MyData = ReadBin("test.jpg")
EnData = Encoder(MyData)
WriteBin "E_test.jpg", EnData
Wscript.echo now & ", 加密: "

Wscript.echo now & ", 解密: "
MyData = ReadBin("E_test.jpg")
UnData = Uncoder(MyData)
WriteBin "U_test.jpg", UnData
Wscript.echo now & ", 解密: "


Function ReadBin(FileName)
 Dim Stream, ObjXML, MyNode
 Set ObjXML = CreateObject("Microsoft.XMLDOM")
 Set MyNode = ObjXML.CreateElement("binary")
 Set Stream = CreateObject("ADODB.Stream")
 MyNode.DataType = "bin.hex"
 Stream.Type = 1
 Stream.Open
 Stream.LoadFromFile FileName
 MyNode.NodeTypedValue = Stream.Read
 Stream.Close
 ReadBin = MyNode.Text
 Set MyNode = Nothing
 Set Stream = Nothing
 Set ObjXML = Nothing
End Function

Function WriteBin(FileName, BufferData)
 Dim Stream, ObjXML, MyNode
 Set ObjXML = CreateObject("Microsoft.XMLDOM")
 Set MyNode = ObjXML.CreateElement("binary")
 Set Stream = CreateObject("ADODB.Stream")
 MyNode.DataType = "bin.hex"
 MyNode.Text = BufferData
 Stream.Type = 1
 Stream.Open
 Stream.Write MyNode.NodeTypedValue
 Stream.SaveToFile FileName, 2
 Stream.Close
 Set stream = Nothing
 Set MyNode = Nothing
 Set ObjXML = Nothing
End Function

Function Encoder(Data)
 Dim K, M
 For n = 0 To Len(Key)-1
  K = K & Asc(Left(Right(key, Len(Key)-n), 1)) & "#"
 Next
 Data = UCase(Data)
 For i = 0 To Len(Data)-1
  M = Left(Right(Mid(Data, i+1, 1), Len(Data)-i), 1)
  For j = 0 To Len(Key)-1
   If i Mod Len(Key) = j  Then
    Encoder = Encoder & Hex((Asc(M) Xor Split(K, "#")(j)))
   End If
  Next
 Next
End Function

Function Uncoder(Data)
 Dim K
 For n = 0 To Len(Key)-1
  K = K & "#" & Asc(Left(Right(key, Len(Key)-n), 1)) & "#X"
 Next
 K = K & K
 Data = UCase(Data)
 For i = 1 To Len(Data) Step 2
  For j = 1 To Len(Key) * 2
   If i Mod Len(Key)*2 = j  Then
    Uncoder = Uncoder & Chr(Split(K, "#")(j) Xor ("&H" & Mid(Data, i, 2)))
   End If
  Next
 Next
End Function

标签:
十六进制,异或加密

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
评论“VBS 十六进制异或加密实现代码”
暂无“VBS 十六进制异或加密实现代码”评论...

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。