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.

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.