Jump to content


Photo

MD5 Question


  • Please log in to reply
5 replies to this topic

#1 dual_alliance

dual_alliance
  • Members
  • PipPipPip
  • Advanced Member
  • 140 posts
  • LocationNSW, Australia

Posted 17 July 2006 - 03:58 PM

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

#2 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 17 July 2006 - 04:03 PM

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.

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 17 July 2006 - 04:04 PM

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.

#4 dual_alliance

dual_alliance
  • Members
  • PipPipPip
  • Advanced Member
  • 140 posts
  • LocationNSW, Australia

Posted 17 July 2006 - 04:06 PM

Thankyou for your help, l understand fully now how it works. :)

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 17 July 2006 - 04:13 PM

as well as for hashes used by different PHP-programs:

md5(md5($pass))
md5(md5($pass).$salt)
md5(md5($salt).md5($pass))
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 Dville

Dville
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 17 July 2006 - 04:14 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users