Jump to content

[SOLVED] MYSQL Encrypt/Hide Passwords


bmdsherman

Recommended Posts

You could use something like md5.

 

 

Store the hashed password in the database and when ever the user submits his password, hash it and compare against the one in the database.

 

Let's say x is the password, and h is the hashing function.

 

 

Now say z = h(x) (z would be stored in the database).

 

 

For user input a, if h(a) = z then allow the user to login.

Hrmmm....  Well if you wanted to MD5 them all, that would be simple.  You would need to change the field to a varchar(32) field (really it could be a char(32), but since you're converting it will need to be varchar, and in this situation it doesn't make much of a difference anyway).

 

 

You would want to do something like:

 

 

ALTER TABLE users CHANGE password password VARCHAR(32);

 

 

Then:

 

UPDATE users SET password = MD5(password);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.