Hello i want to encrypt or hash some data and put them on the database. Which is more secure encryption or hash and how i can do this?
thank you very much for your help
use AES algorithm for encrypting password ans to store it into db.
you can also see the example in following links.
Thank you for the reply. How i can use AES but the key that is used to encrypt and decrypt will be always the same for a user?
Thank you very much
you can see the following link to get more idea about your question
What you want is a one way hash rather than encryption, decryption. You store the hashed password in the database. When you get the password at login time, you hash it and compare it to the version stored in the database. There is absolutely no way to derive the real password from the persisted version.
This is very easy. Use the java.security.MessageDigest class, http://java.sun.com/j2se/1.3/docs/api/java/security/MessageDigest.html. It doesn't really matter which algorithm you choose, MD5 or SHA, but there's plenty of documents on Google comparing the two.
I did the hash for the password but now i want to encrypt some informations that i put in cookie. So i need two way encryption so i can encrypt and decrypt it
Thank you very much i will check the links
i think you have to follow the link through which you can get more ideas about which algorithm to use..AES or MD5....