note 9223 deleted from function.crypt by jimw
| From: | jimw@php.net | Date: | Sun, 16 Dec 2001 20:24:46 +0000 |
| Subject: | note 9223 deleted from function.crypt by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22936@lists.php.net to get a copy of this message | ||
ok, this took me forever to figure out, but here is how to compare DES_STANDARD (2 char salt)
passwords:
<?PHP
$cleartext_password = 'foobar';
$stored_password = 'toP.k27dtGUQA';
$salt = substr($hashed_password, 0, 2);
$crypted_password = crypt($cleartext_password,$salt);
?>
If you want to CREATE a new password, use the advice of the folks above... this is just a method for
comparing, which I couldn't find here and though it would be helpful. Creating is pretty simple
since all you have to do is seed a random salt for the crypt.