Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MessageDigest

 
ravinderSingh singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Can anyone tell me how to reverse the following code so that I can "undigest" the message?

String someString = "whatever";
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] bytes = someString.getBytes();
byte[] digestedBytes = md.digest(bytes);

How can I get the string back after the message has passed through the digest method?

Thanks.
 
Subhash Bhushan C
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure whether you have posted in the right forum, but until some administrator moves it...

Message Digests are digital fingerprints of a message. They take an arbitrary size input, and generate a fixed size output, called a digest or hash. This is one way. You cannot get back the original input from the digest.
It would help you to take a look at the API reference for cryptography.
http://java.sun.com/j2se/1.5.0/docs/api/index.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic