Rodrigo m. Ferreira said:
Hi,
How do I encrypt information for storing in cookies? I used the MD5, but I
don't know how to decrypt information.
Can you help me?
Rodrigo M. Ferreira
Guess what ... if you used MD5 to encrypt then you can not decrypt it ...
MD5 is not encryption. It's a hashing algorithm.. It works best with
passwords.
Simple example of hashing algorithm - length of the string.
Let say you have password "TEST" the hash value is 4. So I keep 4 in my
database. Next time you come to the website I am asking you for the
password. You enter "TEST" I get it's hash value 4 and compare it with
database. It's the same you in.
If you do not know password and enter "PASSWORD" I get hash value 7 and it
does not match my database record. Hence access denied.
1. No one knows the password. So nobody, even Database admin can pretend to
be you.
2. more than one password can generate same hash value... Hence inability to
reverse it.
Obviously in our case to many passwords generate the same hash value. So use
MD5 and not my favorite string's length hashing algorithm...
PS: Check out this article if you still want to use MD5
http://www.codeproject.com/KB/database/md5sql2000.aspx