note 124322 added to function.sha1
| From: | support at neoistone dot com | Date: | Tue, 22 Oct 2019 17:49:10 +0000 |
| Subject: | note 124322 added to function.sha1 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212748@lists.php.net to get a copy of this message | ||
?php
function randomPassword() {
$alphabet =
"AaBbCcDDEeFfMANIKANTAsripadiSEEtharathnamMaCBoOK0CamErA123456789!@#$%^&*()_+{}[]|\:;'<>,.?/".$_SERVER["REMOTE_ADDR"];
$pass = array(); //remember to declare $pass as an array
$alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
for ($i = 1; $i < 103; $i++) {
$n = rand(0, $alphaLength);
$pass[] = $alphabet[$n];
}
$pass = implode($hash);
$hash = sha1(uniqid($pass . mt_rand(), true));
# To get a shorter version of the hash, just use substr
$hash = substr($hash, 0, 12);
return $hash; //turn the array into a string
}
echo randomPassword();
?>
this way is secured
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.195 (proxied: 202.65.142.76)
----
Manual Page -- http://php.net/manual/en/function.sha1.php
Edit -- https://master.php.net/note/edit/124322
Del: integrated -- https://master.php.net/note/delete/124322/integrated
Del: useless -- https://master.php.net/note/delete/124322/useless
Del: bad code -- https://master.php.net/note/delete/124322/bad+code
Del: spam -- https://master.php.net/note/delete/124322/spam
Del: non-english -- https://master.php.net/note/delete/124322/non-english
Del: in docs -- https://master.php.net/note/delete/124322/in+docs
Del: other reasons-- https://master.php.net/note/delete/124322
Reject -- https://master.php.net/note/reject/124322
Search -- https://master.php.net/manage/user-notes.php