note 22098 modified in function.crypt by goba
| From: | goba@php.net | Date: | Thu, 12 Sep 2002 17:04:18 +0000 |
| Subject: | note 22098 modified in function.crypt by goba | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-36586@lists.php.net to get a copy of this message | ||
Calling crypt() with only 1 argument appear to generate MD5 hash instead of DES with autogenerated
salt nowadays, here's my solution:
$mySalt = substr(
ereg_replace("[^a-zA-Z0-9./]","",
crypt(rand(10000000,99999999), rand(10,99))),
2, 2);
echo "hash = ".crypt("mysecret",$mySalt);
--was--
Calling crypt() with only 1 argument appear to generate MD5 hash instead of DES with autogenerated
salt nowadays, here's my solution:
$mySalt = substr(
ereg_replace("[^a-zA-Z0-9./]","",
crypt(rand(10000000,99999999), rand(10,99))),
2, 2);
echo "hash = ".crypt("mysecret",$mySalt);
http://www.php.net/manual/en/function.crypt.php