|
|
|
@ -140,7 +140,7 @@ class SecurityBase
|
|
|
|
|
public static function generateRandomKey($length = 32) |
|
|
|
|
{ |
|
|
|
|
if (function_exists('openssl_random_pseudo_bytes')) { |
|
|
|
|
$key = strtr(base64_encode(openssl_random_pseudo_bytes($length, $strong)), array('+' => '_', '/' => '-', '=' => '.')); |
|
|
|
|
$key = strtr(base64_encode(openssl_random_pseudo_bytes($length, $strong)), '+/=', '_-.'); |
|
|
|
|
if ($strong) { |
|
|
|
|
return substr($key, 0, $length); |
|
|
|
|
} |
|
|
|
|