求帮助,怎样去掉下文中的加密3,只保留加密2加密1.

fudong777 2014-01-16 10:02:37
Set argv = WScript.Arguments
If argv.Count = 0 Then
MsgBox "请把要加密的文件拖到我身上!", 64+4096, "乱码领域"
WScript.Quit
End If

Set fso = CreateObject("Scripting.FileSystemObject")
Randomize
pass = Int(Rnd*12)+20 '异或加密有效范围20-31,所以随机生成好了。
data = fso.OpenTextFile(argv(0), 1).ReadAll
data = "d=" & Chr(34) & ASCdata(data) & Chr(34)
data = data & vbCrLf & ":M=Split(D):For each O in M:N=N&chr(O):Next:execute N"
data = Replace(data, " ", ",")
fso.OpenTextFile(argv(0) & "_加密.vbs", 2, True).Write Encoder(EncHexXorData(data))
MsgBox "加密完毕,文件生成到:" & vbCrLf & vbCrLf & argv(0) & "_加密.vbs", 64+4096, "乱码领域VBS加密"

Function EncHexXorData(data)
EncHexXorData = "x=""" & EncHexXor(data) & """:For i=1 to Len(x) Step 2:s=s&Chr(CLng(""&H""&Mid(x,i,2)) Xor " & pass & "):Next:Execute Replace(s,"","","" "")"
End Function

'Function Encoder(data) '加密3
'Encoder = CreateObject("Scripting.Encoder").EncodeScriptFile(".vbs", data, 0, "VBScript")
'End Function

Function EncHexXor(x) '加密2
For i = 1 To Len(x)
EncHexXor = EncHexXor & Hex(Asc(Mid(x, i, 1)) Xor pass)
Next
End Function

Function ASCdata(Data) '加密1
num = Len(data)
newdata = ""
For j = 1 To num
If j = num Then
newdata = newdata&Asc(Mid(data, j, 1))
Else
newdata = newdata&Asc(Mid(data, j, 1)) & " "
End If
Next
ASCdata = newdata
End Function
...全文
144 点赞 收藏 回复
写回复
回复

还没有回复,快来抢沙发~

发动态
发帖子
VBA
创建于2007-09-28

1576

社区成员

1.0w+

社区内容

VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区公告
暂无公告