note 28612 deleted from function.md5 by jimw
| From: | jimw@php.net | Date: | Sat, 08 Feb 2003 19:51:00 +0000 |
| Subject: | note 28612 deleted from function.md5 by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43650@lists.php.net to get a copy of this message | ||
Here's a password generator that creates more robust passwords:
srand((double)microtime()*1000000);
$unique_str = md5(rand(0,9999999));
$unique_str = base64_encode(pack("h*", $unique_str));
// that packs the 128-bit hex value into a 16-character binary
// string, then expands it out to a 20-ish character base 64 string.
// this middle of this string has reasonably high-quality random
// characters including all of 0-9,a-z,A-Z, and /
// now to prevent someone misreading easily mistaken characters,
// and chop it down to a reasonable length:
$unique_str = substr(strtr($unique_str, "l/1ID0O", "Ab3Ef6H"),5,8);