Jump to content

Archived

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

dual_alliance

MD5 Question

Recommended Posts

I have seen many tutorials written, and they have used the MD5 function.  However l don't understand fully how it works.

Does it work by the user enters a password (in register.php) l encrypt it and send it to a MySQL database.  Then when the user logs in (login.php) it converts that password to MD5 and checks to see if it matches with the MD5 password stored in the MySQL database?

Thanks,

dual_alliance

Share this post


Link to post
Share on other sites
Yep. I prefer to use the SHA() function myself, but it's basically the same thing.

Lets say you enter password as your password. You store is as md5('password') and when you check it, you check
if ((md5($_POST['password']) === (md5($password))) {
  // whatever
}
Where $password is the password you pulled from the db.

Share this post


Link to post
Share on other sites
md5 encrypts the users password in a 32bit encryption. It is a one way encryption which mean it cannot be decrypted, however you can but its not easy as it'll take you while to decrypt it.

Share this post


Link to post
Share on other sites
as well as for hashes used by different PHP-programs:

md5(md5($pass))
md5(md5($pass).$salt)
md5(md5($salt).md5($pass))

Share this post


Link to post
Share on other sites
make sure you make the db field enough to hold the actual encrypt password too. that slipped my mind for the first minute or so, when I tried with a 8 character limit, lol

Share this post


Link to post
Share on other sites

×

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.