Meaningless Drivel is fun!
The moose likes Java in General and the fly likes Data Encryption & Decryption in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Data Encryption & Decryption in Java" Watch "Data Encryption & Decryption in Java" New topic

Data Encryption & Decryption in Java

Hari Dhanakoti
Ranch Hand

Joined: Jan 07, 2008
Posts: 74
Hi all,

I am now working with encryption and decryption algorithm in java.
As of now i am making use of the MD5 algorithm to encrypt the data.
I can encrypt the value to a hexadecimal values.

I am not able to get original String value after decryption.

Is there is any way to achieve the original data?

If not how can we convert the hexadecimal values to Strings?
Please help me out ASAP..

I am totally hanged up with this issue.

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

MD5 is a hashing algorithm, not an encryption algoritm. You are not meant to be able to get the original value from it.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
MD5 is not cipher, but a hash or digest. The difference is that ciphers can be reversed (in other words, you can get back the original text), but digests can't.

So for encryption -where you want the original text back- you can't use MD5. Ciphers you could use include AES, DESede and Blowfish, amongst others.

The contains several links regarding the use of the JCE API which may be helpful.
I agree. Here's the link:
subject: Data Encryption & Decryption in Java
It's not a secret anymore!