Has anyone used MD5 Checksum in Access

F

Fred Wilson

Hello,

I am working on a project that I would like to take a value in a text
box, run it through and MD5 checksum and store that value in the database.

Now with that said, I have not even generated the first line of code for
this textbox (txtHclSampleRun). Of course the value is currently be
stored in its raw form.

Any hints and/or directions?

Thank you,
Fred
 
B

Brendan Reynolds

Well, it's a class, so don't try pasting it into a standard module. Create a
new, empty class module named clsMD5, and copy and paste everything from
'Option Explicit' on down to the end. You can safely ignore the class
attribute stuff before the Option Explicit statement.

It has been quite some time since I used it now, so I'm not really
up-to-speed on it, but here's the code in which I used it ...

Dim objMD5 As clsMD5

Set objMD5 = New clsMD5
Print #intFile, Space$(4) & "<AuthenticationHash>" &
objMD5.DigestStrToHexStr(Me!txtUserID & Me!txtPassword & strTransactionID) &
"</AuthenticationHash>"

Leaving out the parts of the above code that were specific to my
application, here's a simplified example that prints the result of hashing
some text to the Immediate Window ...

Public Sub TestMD5()

Dim objMD5 As clsMD5 '<- declare the class variable
Set objMD5 = New clsMD5 '<- instantiate it
Debug.Print objMD5.DigestStrToHexStr("Hello World!") 'call the
DigestStrToHexStr method passing the string you want to hash

End Sub

Result in the Immediate Window ...

testmd5
ED076287532E86365E841E92BFC50D8C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top