Empty commit

This commit is contained in:
Git 2016-05-02 08:00:27 +00:00
parent b572fbe921
commit ef3be48650
3 changed files with 9 additions and 21 deletions

10
api.php
View File

@ -39,13 +39,9 @@ function error($Code) {
}
function make_secret($Length = 32) {
$Secret = '';
$Chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
for ($i = 0; $i < $Length; $i++) {
$Rand = mt_rand(0, strlen($Chars) - 1);
$Secret .= substr($Chars, $Rand, 1);
}
return str_shuffle($Secret);
$NumBytes = (int) round($Length / 2);
$Secret = bin2hex(openssl_random_pseudo_bytes($NumBytes));
return substr($Secret, 0, $Length);
}
function is_number($Str) {

View File

@ -110,13 +110,9 @@ function display_array($Array, $DontEscape = array()) {
}
function make_secret($Length = 32) {
$Secret = '';
$Chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
for ($i = 0; $i < $Length; $i++) {
$Rand = mt_rand(0, strlen($Chars) - 1);
$Secret .= substr($Chars, $Rand, 1);
}
return str_shuffle($Secret);
$NumBytes = (int) round($Length / 2);
$Secret = bin2hex(openssl_random_pseudo_bytes($NumBytes));
return substr($Secret, 0, $Length);
}
// Send a message to an IRC bot listening on SOCKET_LISTEN_PORT

View File

@ -360,13 +360,9 @@ public static function release_order_default_js(&$SiteOptions) {
* @return random alphanumeric string
*/
public static function make_secret($Length = 32) {
$Secret = '';
$Chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
$CharLen = strlen($Chars) - 1;
for ($i = 0; $i < $Length; ++$i) {
$Secret .= $Chars[mt_rand(0, $CharLen)];
}
return $Secret;
$NumBytes = (int) round($Length / 2);
$Secret = bin2hex(openssl_random_pseudo_bytes($NumBytes));
return substr($Secret, 0, $Length);
}
/**