note 9223 added to crypt
| From: | stephen at opido dot com | Date: | Mon, 23 Oct 2000 22:17:46 +0000 |
| Subject: | note 9223 added to crypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6911@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.
http://www.php.net/manual/function.crypt.php