PHP secure logon script - md5 hash is not matching the hash i wrote to the database in a previous sc
Posted
by Chris Sobolewski
on Stack Overflow
See other posts from Stack Overflow
or by Chris Sobolewski
Published on 2010-06-13T01:40:25Z
Indexed on
2010/06/13
1:42 UTC
Read the original article
Hit count: 305
I am trying to cobble together a login script in PHP as a learning project.
This is the code for my database write when the user registers. Both of these values are written to the database.
$this->salt = md5(uniqid());
$this->password = md5($password.$salt);
Upon logging in, the following function is fired. For some
function challengeLogin($submittedPassword, $publicSalt, $storedPassword){
if(md5($submittedPassword.$publicSalt) == $actualPassword){
return 0;
}else{
return 1;
};
}
Unfortunately, on stepping through my code, the two values have never equaled. Can someone help me understand why?
© Stack Overflow or respective owner