note 25088 deleted from function.crypt by aidan
| From: | aidan@php.net | Date: | Mon, 05 Jul 2004 10:26:23 +0000 |
| Subject: | note 25088 deleted from function.crypt by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72578@lists.php.net to get a copy of this message | ||
Note Submitter: pao@chiangmaicar.com
----
Before you use this function. Don't forget to read this content of manual carefully.
"The standard DES-based encryption crypt() returns the salt as the first two characters of the
output. It also only uses the first eight characters of str, so longer strings that start with the
same eight characters will generate the same result (when the same salt is used)."
For example when I want to crypt $f_pass with first two characters of my password as salt. The code
flow:
<?PHP
$f_pass="12345678";
echo $ht_pass = crypt($f_pass,substr($f_pass,0,2));
?>
The output will be 12yJ.Of/NQ.Pk
If $f_pass changed the result will be different.
But if $f_pass is "123456789" or "1234567891" or "12345678xxxxxxx...."
the result of crypt function will be the same as "12345678" ==> 12yJ.Of/NQ.Pk