Created
November 8, 2016 12:58
-
-
Save ken-itakura/c35455bccbae1544189e37b713698b75 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 |
Thanks ken-itakura and dandfra for the code.
By using the description on dummies.com I was able to insert a new column containing the crypted password in excel.
I'm not a programmer, more a "copy an paste tinkerer".
So I'm gently asking you for help to get the function as a button in a form into access.
The comlumns I use is passwort as source and cpasswort as target.
Can you please help me with that, if it's not too much time and effort.
Thanks and have a nice day
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it didn't work for me, I had to explicitly convert the string to bytes using an UTF-8 encoding to get the correct result: