mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
Simplified make_rand_str function
https://github.com/torrentpier/torrentpier/pull/575 Fixed: PHP Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash.
This commit is contained in:
parent
fd398330d6
commit
eecfb9a999
@ -301,12 +301,7 @@ function str_compact ($str)
|
|||||||
|
|
||||||
function make_rand_str ($len = 10)
|
function make_rand_str ($len = 10)
|
||||||
{
|
{
|
||||||
$str = '';
|
return substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', (int)$len)), 0, $len);
|
||||||
while (strlen($str) < $len)
|
|
||||||
{
|
|
||||||
$str .= str_shuffle(preg_replace('#[^0-9a-zA-Z]#', '', crypt(uniqid(mt_rand(), true))));
|
|
||||||
}
|
|
||||||
return substr($str, 0, $len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bencode: based on OpenTracker
|
// bencode: based on OpenTracker
|
||||||
|
Loading…
Reference in New Issue
Block a user