469,270 Members | 1,026 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

How to encrypt and decrypt passwords in a database

Any one help me how to encrypt and decrypt passwords.And the password field is in database(mysql database) how to encrypt and decrypt that password saved in database.
Aug 20 '09 #1
4 3087
8,651 Expert Mod 8TB
if you need password protection (like save a pw in a db non-human-readable) go for the pws hash value (hash()) using a decend method (sha256, ripemd, ). for encryption/decryption using keys try the OpenSSL or Mcrypt functions.
Aug 20 '09 #2
Dheeraj Joshi
1,123 Expert 1GB
And do not forget to do salting.

Dheeraj Joshi
Aug 20 '09 #3
6,050 Expert 4TB
Check out MySQL's aggregate (en|de)crypt functions.
Aug 20 '09 #4
If you use .NET for your application try to use Bonnie.NET at http://www.we-coffee.com/bonnie.aspx. It's a free dll that manages all cryptographic need.

To protect your password, probably the best choice is to use hash functions. If someone stoles your password an hash cannot be rever to the initial value. An attacker could try a sort of brute force attack not directly with the passwords use to discovery your password but hashing them first, making the hash not safe. To avoid this problem try to use keyed hash function (for example HMACSHA1). Bonnie.NET let you to do so.
Sep 26 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

14 posts views Thread by msnews.microsoft.com | last post: by
2 posts views Thread by Daniel | last post: by
1 post views Thread by Microsoft | last post: by
8 posts views Thread by toupeira23 | last post: by
4 posts views Thread by Gilles Ganault | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.