note 15345 deleted from function.crypt by jimw
| From: | jimw@php.net | Date: | Sun, 16 Dec 2001 20:10:05 +0000 |
| Subject: | note 15345 deleted from function.crypt by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22932@lists.php.net to get a copy of this message | ||
Here's a function I use to compare a crypt()'ed password to a user-supplied plaintext
version:
function password_compare($plaintext, $crypted) {
return (crypt($plaintext, substr($crypted, 0, 2)) == $crypted);
}
returns true if the plaintext password properly matches the evcrypted password (note: 2 character
salt. You can change this -- it's the third param in substr())
S