md5() problem

They have: 105 posts

Joined: Mar 2006

Hi,

I can use md5($password) to encrypt passwords, but can't seem to get it to work for when the user wants to log in.

For example,

// Encrypt password
$passwordmd5 = md5($password);

So when the user enters their password to login, I use the same code as above to encrypt the password they entered to check it against the encrypted password in the database, but it doesn't work. Why is this?

They have: 105 posts

Joined: Mar 2006

I found out why it didn't work, it was because the password field in the database was 10 characters which meant it didn't store the 32 characters of the encrypted password. I changed it to 32 characters and it worked.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.