温馨提示×

如何加密vbs数据

九三
397
2021-01-18 10:53:22
栏目: 编程语言

如何加密vbs数据

通过在vbs中使用Execute对数据进行加密,代码如下:

On Error Resume Next

Set argv = WScript.Arguments

If argv.Count = 0 Then WScript.Quit

Set fso = CreateObject("scripting.filesystemobject")

With fso.OpenTextFile(argv(0),1)

data = .ReadAll : .Close

End With

With fso.OpenTextFile(argv(0)&".txt",2,True)

.WriteLine "data="&Chr(34)&ASCdata(data)&Chr(34)

.WriteLine "Function ChrData(Data)"

.WriteLine "MyArray = Split(Data, "","", -1, 1)"

.WriteLine "For each OldData in MyArray"

.WriteLine "Newdata=NewData"&Chr(38)&"chr(OldData)"

.WriteLine "Next"

.WriteLine "ChrData=NewData"

.WriteLine "End Function"

.WriteLine "execute Chrdata(data)"

.Close

End With

MsgBox "OK!",,"Encrypt"

Function ASCdata(Data)

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

使用方法:将需要加密的VBS脚本拖动到这个加密程序文件中即可实现加密。

0