MD5

Hey,

I've had two, similar strange experiences with MD5-encryption. I'm currently testing and developing an application, with users and passwords and stuff. In the 'add new user'-section, I've got two password fields. In 'processnewuser.jsp' I compared MD5-hash 1 to MD5-hash 2, coming out of the form fields 'password' and 'password confirmation' respectively. Those MD5-hashesnever matched, while I was certain the words were similar.

That's the first strange thing.

Secondly, I had a word transformed to an MD5-hash, to manually add in into the database, so I could save time by not completing the whole 'add new user'-form. So, for example, I convert the word 'hello', which results in 'DK428DK9DH492' or whatsoever, I insert the hash into the database, login with 'hello' and the corresponding username, but it fails to login because the password is incorrect. I.e., the hashes simply didn't match.

What's my problem?

Thanks in advance!

[1008 byte] By [Nidhuggura] at [2007-11-27 4:12:25]
# 1
Solved.
Nidhuggura at 2007-7-12 9:18:25 > top of Java-index,Security,Cryptography...
# 2
>> What's my problem?> I bet you were converting the MD5 hash to a String usingString hashAsString = new String(hashAsBytes);
sabre150a at 2007-7-12 9:18:25 > top of Java-index,Security,Cryptography...
# 3

Hehe, no. As to case 1, the problem was just as simple as the solution. I copied my working MD5-script, to create a new hash, but I'm using a script with about 8 variables, and forgot to change one of them, so a hash was made by converting the previous hash, haha.

The second case is solved, without knowing what the solution has been.

Nidhuggura at 2007-7-12 9:18:25 > top of Java-index,Security,Cryptography...
# 4
> Hehe, no. Ah well! My crystal ball is not working so well today.
sabre150a at 2007-7-12 9:18:25 > top of Java-index,Security,Cryptography...