WScript.Echo getSHA1("myteststring")
Function getSHA1(instr)
Dim asc, enc, bytes, outstr, pos
'.NET 1.1 (and higher) objects
Set asc = CreateObject("System.Text.UTF8Encoding")
Set enc = CreateObject("System.Security.Cryptography.SHA1CryptoServiceProvider")
'Convert the string to a byte array and hash it
bytes = asc.GetBytes_4(instr)
bytes = enc.ComputeHash_2((bytes))
getSHA1 = ""
'Convert the byte array to a hex string
For pos = 1 To Lenb(bytes)
getSHA1 = getSHA1 & LCase(Right("0" & Hex(Ascb(Midb(bytes, pos, 1))), 2))
Next
End Function
Comments