I'm working on this function, but the output is always an incorrect hash. Any ideas?
Thanks.
Function SHA1(s)
Dim asc, enc, bytes, outstr, pos
Set asc = CreateObject("System.Text.UTF8Encoding")
Set enc = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")
bytes = asc.GetBytes_4(s)
bytes = enc.ComputeHash_2((bytes))
outstr = ""
For pos = 1 To Lenb(bytes)
outstr = outstr & LCase(Right("0" & Hex(Ascb(Midb(bytes, pos, 1))), 2))
Next
SHA1 = outstr
wscript.echo SHA1
Set asc = Nothing
Set enc = Nothing
End Function
Thanks.
Function SHA1(s)
Dim asc, enc, bytes, outstr, pos
Set asc = CreateObject("System.Text.UTF8Encoding")
Set enc = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")
bytes = asc.GetBytes_4(s)
bytes = enc.ComputeHash_2((bytes))
outstr = ""
For pos = 1 To Lenb(bytes)
outstr = outstr & LCase(Right("0" & Hex(Ascb(Midb(bytes, pos, 1))), 2))
Next
SHA1 = outstr
wscript.echo SHA1
Set asc = Nothing
Set enc = Nothing
End Function