# Solved: MySQL Field Encryption



## pcpro17 (Oct 9, 2006)

What is the preferred method for encrypting a field in MySQL, say, for a user password in a site members table? Thanks!


----------



## colinsp (Sep 5, 2007)

md5 or sha1. Sha1 is less common. There are, however, various tools available that will convert md5 and presumably sha1 encrypted passwords back to real words.


----------



## dudeking (Feb 7, 2007)

Do what ive got user enters password last 3 letters cut off string and encryped with md5 into field called userpass1 and rest is encrypted into userpass2 as md5.

When user then enters password to login same process happens and both encrypted keys are compared.

It basically doubles your security with two passwords with out the user being any wiser.

I suppose theoretically you could even use a different encryption method on each field.


----------



## pcpro17 (Oct 9, 2006)

Thanks for the suggestions, everyone. I've got this working with AES_ENCRYPT and AES_DECRYPT.


----------

