1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
sPlain = "0000000000000000"
g_CryptThis = sPlain
Const g_KeyLocation = "/code.txt"
Dim g_Key
g_Key = mid(ReadKeyFromFile(g_KeyLocation),1,Len(g_CryptThis))
Function ReadKeyFromFile(strFileName)
Dim keyFile, fso, f
set fso = Server.CreateObject("Scripting.FileSystemObject")
set f = fso.GetFile(strFileName)
set ts = f.OpenAsTextStream(1, -2)
Do While not ts.AtEndOfStream
keyFile = keyFile & ts.ReadLine
Loop
ReadKeyFromFile = keyFile
End Function
sPassword = g_Key
MyEncrypt(sPlain, sPassword)
Public Function MyEncrypt(sPlain, sPassword)
Dim bytIn()
Dim bytPassword()
Dim lLength
Dim lCount
Dim sTemp
lLength = Len(sPlain)
ReDim bytIn(lLength-1)
For lCount = 1 To lLength
bytIn(lCount-1)=CByte(AscB(Mid(sPlain,lCount,1)))
Next
lLength = Len(sPassword)
ReDim bytPassword(lLength-1)
For lCount = 1 To lLength
bytPassword(lCount-1)=CByte(AscB(Mid(sPassword,lCount,1)))
Next
bytOut = EncryptData(bytIn, bytPassword)
sTemp = ""
For lCount = 0 To UBound(bytOut)
sTemp = sTemp & Right("0" & Hex(bytOut(lCount)), 2)
Next
MyEncrypt = sTemp
End Function |
Partager