Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java MD5 Security problem

 
Amar Naik
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

i wanted tyo know how does MD5 protocol encrypt a letter.
bcz i am having problems with the encryption.
the encrypted o/p is different on different machines.
plz help

thanks in advance
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the algorithm:
http://www.faqs.org/rfcs/rfc1321.html
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't this something for the security forum? --- How are you calculating the MD5 checksum? The Sun JDK contains an MD5 implementation for the JCA (Java Cryptography Architecture) API. See java.security.MessageDigest.
- Peter
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably, I think he wants more of the information on the MD5 algorithm than the actual implementation. He's saying that he gets different result on differnt platforms.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pity he doesn't give more detail: different machines are mentioned, but are we talking about different software platforms too? If not, for example they both use the Java MessageDigest implementation, then the problem might well be an encoding problem in the conversion from a String to a byte[] (hint: enforce a standard encoding such as UTF-8 so you're independent of what the platform default encoding happens to be). The MD5 algorithm wouldn't help at all in that case. OTOH if they're different software platforms, perhaps with a broken MD5 implementation, then the algorithm might well help.
- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic