Created
October 19, 2018 20:33
-
-
Save SethVandebrooke/ca3c21f6e4c9eeffae11dcc11f8a9370 to your computer and use it in GitHub Desktop.
Classic ASP / VBScript SHA1 Hashing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sha1HashString(str) | |
Dim hexStr, x, aBytes, sha1 | |
aBytes = CreateObject("System.Text.UTF8Encoding").GetBytes_4(str) | |
set sha1 = CreateObject("System.Security.Cryptography.SHA1Managed") | |
sha1.Initialize() | |
aBytes = sha1.ComputeHash_2( (aBytes) ) | |
for x=1 to lenb(aBytes) | |
hexStr= hex(ascb(midb( (aBytes),x,1))) | |
if len(hexStr)=1 then hexStr="0" & hexStr | |
sha1HashString=sha1HashString & hexStr | |
next | |
end function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment