-
-
Save blackskye-sx/5660c7fa20081f5b3847ca077a240a04 to your computer and use it in GitHub Desktop.
Excel, Access VBA Function to create MD5 for text
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 MD5Hex(textString As String) As String | |
Dim enc | |
Dim textBytes() As Byte | |
Dim bytes | |
Dim outstr As String | |
Set enc = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider") | |
textBytes = textString | |
bytes = enc.ComputeHash_2((textBytes)) | |
For pos = 1 To LenB(bytes) | |
outstr = outstr & LCase(Right("0" & Hex(AscB(MidB(bytes, pos, 1))), 2)) | |
Next | |
MD5Hex = outstr | |
Set enc = Nothing | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment