Last active
October 15, 2018 12:05
-
-
Save LNow/8823962 to your computer and use it in GitHub Desktop.
This file contains 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
Public Function SHA1Hash(content As String) As String | |
Dim asc As Object | |
Set asc = CreateObject("System.Text.UTF8Encoding") | |
Dim enc As Object | |
Set enc = CreateObject("System.Security.Cryptography.SHA1CryptoServiceProvider") | |
Dim bytes() As Byte | |
bytes = asc.GetBytes_4(content) | |
bytes = enc.ComputeHash_2((bytes)) | |
Dim pos As Long | |
For pos = 0 To UBound(bytes) | |
SHA1Hash = SHA1Hash & LCase(Right("0" & Hex(AscB(MidB(bytes, pos + 1, 1))), 2)) | |
Next | |
Set asc = Nothing | |
Set enc = Nothing | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment