Fix smd5 password comparison for sql

This commit is contained in:
Miles Lott 2004-02-05 02:01:39 +00:00
parent 85495afde2
commit dfa356e0c6

View File

@ -216,10 +216,13 @@
{ {
/* Start with the first char after {SMD5} */ /* Start with the first char after {SMD5} */
$hash = base64_decode(substr($db_val,6)); $hash = base64_decode(substr($db_val,6));
$new_hash = mhash(MHASH_MD5,$form_val); $orig_hash = substr($hash, 0, 16);
$salt = substr($hash, 16);
$new_hash = mhash(MHASH_MD5,$form_val . $salt);
//echo '<br> DB: ' . base64_encode($orig_hash) . '<br>FORM: ' . base64_encode($new_hash); //echo '<br> DB: ' . base64_encode($orig_hash) . '<br>FORM: ' . base64_encode($new_hash);
if(strcmp($hash,$new_hash) == 0) if(strcmp($orig_hash,$new_hash) == 0)
{ {
return True; return True;
} }