wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes String encryption and decryption algorthm for small/medium-sized application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "String encryption and decryption algorthm for small/medium-sized application" Watch "String encryption and decryption algorthm for small/medium-sized application" New topic
Author

String encryption and decryption algorthm for small/medium-sized application

Ravi Sree
Ranch Hand

Joined: Jan 24, 2010
Posts: 62

Hi all,

I am working on a module which takes some input from user and encrypts the String before saving to the database,
Now i have a requirement is to decrypt the same string to use it for various processes.

For eg
To generate a unique encrypted String id from the user input.

I tried generating a random int and concatenating the string from user to this int and then encrypting
but then again how can i decrypt the same to the get the value inserted by user at another place for another process.

I know of the Java MD5/SHA Digesters which to do a similar function.
But since this seems to be like no dehashing/decrypting, only half of the requirement is accomplished.

Please suggest a good method to tackle this situation.

Thanks in advance,
Sree

(P.S I haven't tried JCA and didn't get any reading material to start with.)
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

MD5 and SHA are not encryption algorithms but hash algorithms. You can see it as one way encryption. You should look into JCE. I know that some of one will say "duh!" to the following statement but to be sure: please don't invent our own encryption algorithm.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Ravi Sree
Ranch Hand

Joined: Jan 24, 2010
Posts: 62

Wouter Oet wrote:MD5 and SHA are not encryption algorithms but hash algorithms. You can see it as one way encryption. You should look into JCE. I know that some of one will say "duh!" to the following statement but to be sure: please don't invent our own encryption algorithm.


Hi Wouter,

Thanks for replying,
I had written JCA for JCE by mistake earlier.
I understand reinventing the wheel is not always the right thing,
But i thought there might be some simple algorithm to come up with,
but couldn't think of a correct but simple way...

Can you suggest any e-books or links for starting with JCE
(will be much obliged if those are with some examples.)

Regards,
Sree
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
The SecurityFaq has several introductory links regarding JCE including code examples.
Ravi Sree
Ranch Hand

Joined: Jan 24, 2010
Posts: 62

Lester Burnham wrote:The SecurityFaq has several introductory links regarding JCE including code examples.


Thanks Lester,
I will check those links right away.
 
jQuery in Action, 2nd edition
 
subject: String encryption and decryption algorthm for small/medium-sized application
 
Similar Threads
if i store a password data from jsp to the database how to hide it from others seeing
How to use blowfish
Time-Date Conversion??
encrypt/decrypt with sunjce....help reqd ! Thanks
searchToken and replacing it with user input