File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes MessageDigest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "MessageDigest" Watch "MessageDigest" New topic


ravinderSingh singh
Ranch Hand

Joined: Nov 18, 2004
Posts: 41

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?

Subhash Bhushan C
Ranch Hand

Joined: Jan 27, 2005
Posts: 106
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.

Regards,<br />Subhash Bhushan.
I agree. Here's the link:
subject: MessageDigest
It's not a secret anymore!