mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
More performance optimized/random string generation, removed passkey length limit from the announcer (#1013)
This commit is contained in:
parent
c69712a463
commit
725773254f
7 changed files with 20 additions and 17 deletions
11
common.php
11
common.php
|
@ -102,7 +102,7 @@ define('BB_BT_TRACKER', 'bb_bt_tracker');
|
|||
define('BB_BT_TRACKER_SNAP', 'bb_bt_tracker_snap');
|
||||
define('BB_BT_USERS', 'bb_bt_users');
|
||||
|
||||
define('BT_AUTH_KEY_LENGTH', 10);
|
||||
define('BT_AUTH_KEY_LENGTH', 20);
|
||||
|
||||
define('DL_STATUS_RELEASER', -1);
|
||||
define('DL_STATUS_DOWN', 0);
|
||||
|
@ -297,9 +297,14 @@ function str_compact($str)
|
|||
*/
|
||||
function make_rand_str($length = 10): string
|
||||
{
|
||||
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$pool = str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
||||
|
||||
return substr(str_shuffle(str_repeat($pool, (int)$length)), 0, $length);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $pool[random_int(0, 61)];
|
||||
}
|
||||
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
function array_deep(&$var, $fn, $one_dimensional = false, $array_only = false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue