Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement