Making md5-hash 'mysql compatible'

From: Daan (d_stolp_at_nospam.hotmail.com)
Date: 03/03/04


Date: Wed, 3 Mar 2004 10:12:05 +0100

To store a password in a database, I have used MySQL's MD5-function to
create a hash of the password. Now I have a user who enters a password
(via an html form) that needs to be checked. I have tried to create an
md5-hash using the MessageDigest class, but since this works on bytes
(not on strings), I have not been able to create a hash (as a string)
that I can compare to the hash string that is stored in the database.

How can I create a hash of the password that the user enters, such that
is is equal to the hash in the MySQL database? (provided that the user
enters the right password)

Thanks in advance,

-- 
Daan Stolp