Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

From MD5-string to byte array

843789Jan 6 2010 — edited Jan 11 2010
Hi fellows, I'm writing a simple cracker for MD5. The hash value has to be passed at command line as argument.
e.g.
java Cracker 0cc175b9c0f1b6a831c399e269772661
In order to decode the hash value I'm using a brute force approach: therefore I compare a series of strings with the hash value by using the method of the class MessageDigest isEqual(byte[] a, byte[] b). So I encode each string and compare the byte array I get with the byte array of the hash value.
Here it comes the trouble I'm in:
when I try to get a bytes array of the MD5 hash value passed as argument of the program , I do get something, but it's not something that the isEqual method of MessageDigest can use to compare. As a result any attempt during the execution of brute force fails, even though the key is one of the string being checked.
Perhaps am I facing a format problem? Any idea?

Sorry for my english, it's not my first language

Thanks to whoever will help
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 8 2010
Added on Jan 6 2010
13 comments
1,211 views