note 54335 deleted from function.md5 by joey
| From: | joey@php.net | Date: | Sun, 17 Jul 2011 08:45:32 +0000 |
| Subject: | note 54335 deleted from function.md5 by joey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181617@lists.php.net to get a copy of this message | ||
Note Submitter: Helpful Harry
----
check out these functions to fake a sha1 entry using md5. Very, very secure if attackers get your
password file...
also, it encrypts differently for the same string, every time
function pw_encode($password)
{
for ($i = 1; $i <= 8; $i++)
$seed .= substr('0123456789abcdef', rand(0,15), 1);
return md5($seed.$password).$seed;
}
function pw_check($password,$stored_value)
{
$stored_seed = substr($stored_value,32,8);
if (md5($stored_seed.$password).$stored_seed == $stored_value)
return TRUE;
else
return FALSE;
}