This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data Encryption & Decryption in Java

 
Hari Dhanakoti
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MD5 is a hashing algorithm, not an encryption algoritm. You are not meant to be able to get the original value from it.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 http://faq.javaranch.com/java/SecurityFaq contains several links regarding the use of the JCE API which may be helpful.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic