Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Data Encryption & Decryption in Java

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic