note 19085 deleted from function.md5 by jimw
| From: | jimw@php.net | Date: | Sat, 08 Feb 2003 19:47:30 +0000 |
| Subject: | note 19085 deleted from function.md5 by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43626@lists.php.net to get a copy of this message | ||
In reference to:cjgraham@tachegroup.com (14-Jan-2002 12:18)
If you use md5 to generate a password you only have 15 chars (0-9,a-f) and that is a really bad
password.
Better, if you work with 0-9,A-Z,a-z and generate it with e.g. this function:
function generatekey($count)
{
mt_srand((double)microtime()*1000000);
$key = "";
for ($i=0; $i<$count; $i++)
{
$c = mt_rand(0,2);
if ($c==0)
{
$key .= chr(mt_rand(65,90));
}
elseif ($c==1)
{
$key .= chr(mt_rand(97,122));
}
else
{
$key .= mt_rand(0,9);
}
}
return $key;
}
You can add other chars like *,&,%,$,§,-,., etc. of course, too, if needed.
Bye
Daniel