note 80388 deleted from function.crypt by joey
| From: | joey@php.net | Date: | Mon, 27 Dec 2010 12:16:17 +0000 |
| Subject: | note 80388 deleted from function.crypt by joey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175221@lists.php.net to get a copy of this message | ||
Note Submitter: Maarten
----
The previous poster (whatnet) is confused about having to store the (random) value used as the
original salt when the password is first encrypted. This is not necessary because the output of
crypt() includes the salt used to do the encryption, so the encrypted password you store in your
user database is exactly what you would feed it back in later.
In order to validate a password, just do what the example above suggests:
<?php
if (crypt($user_input, $encrypted_password) == $encrypted_password) {
echo "Password verified!";
}
?>