Created
February 14, 2024 16:58
-
-
Save kaugesaar/53504eed1f29eff9a1bda375751ff24d to your computer and use it in GitHub Desktop.
SHA256 Excel Formula
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 SHA256Hash(Text As String) As String | |
Dim asc As Object | |
Dim enc As Object | |
Dim TextBytes() As Byte | |
Dim HashBytes() As Byte | |
Dim i As Integer | |
Set asc = CreateObject("System.Text.UTF8Encoding") | |
Set enc = CreateObject("System.Security.Cryptography.SHA256Managed") | |
TextBytes = asc.GetBytes_4(Text) | |
HashBytes = enc.ComputeHash_2((TextBytes)) | |
SHA256Hash = "" | |
For i = 0 To UBound(HashBytes) | |
SHA256Hash = SHA256Hash & LCase(Right("0" & Hex(HashBytes(i)), 2)) | |
Next i | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment