Understanding crypt()
Posted: Wed Jan 19, 2005 9:45 pm
I was reading the following article when I got confused.
Article: http://www.devshed.com/c/a/PHP/Using-th ... unction/2/
Firstly, the following password was stored in the database after encrypting:
When verifying the password received from a login form with the one in the database:
What I'm confused is, how is the encrypted password in the database, without a salt provided (first code), be the same as the encrypted password with a salt provided? (second code)
Article: http://www.devshed.com/c/a/PHP/Using-th ... unction/2/
Firstly, the following password was stored in the database after encrypting:
Code: Select all
$pwrd = crypt(trim("$_POSTїpword]"));
//$pwrd will be stored into the database and $_POSTїpword] is the password from the registration form.Code: Select all
if(crypt($pwrd,$rowїpword]) == $rowїpword])
//Where $pwrd is the password from the login form, $rowїpword] is the crypted password from the database.