Urgent, Problems usind MD5 digest passwords
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Katrin_Perry
Posted On:   Wednesday, February 6, 2002 02:46 AM

Hi, I have a table in my database with users and their passwords. I used the utility called digest (in CATALINA-HOME/bin) to digest the passwords before I put them in the database. This worked fine with using FORM authentication and Database realm. But I wanted to implement all the login logic myself to gain better control. So I get the password supplied by the user and try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(password.getBytes()); digest1 =md.digest(); digestlenght = md.getDigestLength(); } Then I get the password stored in the database and try to compare them. For my big surprise it turned out that the   More>>

Hi,
I have a table in my database with users and their passwords. I used the utility called digest (in CATALINA-HOME/bin) to digest the passwords before I put them in the database.
This worked fine with using FORM authentication and Database realm. But I wanted to implement all the login logic myself to gain better control.
So I get the password supplied by the user and


try {

MessageDigest md = MessageDigest.getInstance("MD5");

md.update(password.getBytes());
digest1 =md.digest();

digestlenght = md.getDigestLength();

}


Then I get the password stored in the database and try to compare them. For my big surprise it turned out that the sizes for the messagedigest produced by the digest utility is 32 symbols, but the one produced in my servelet using the above code is only 16. Where do things go wrong? I use TOMCAT 4.0.1.

Please, Help

   <<Less
About | Sitemap | Contact