Fix random_key()
This commit is contained in:
parent
24522067ce
commit
3414c6a0ce
1 changed files with 4 additions and 1 deletions
|
@ -1162,7 +1162,10 @@ function random_key($len, $readable = false, $hash = false)
|
|||
$key .= (string) mcrypt_create_iv($len, MCRYPT_DEV_URANDOM);
|
||||
}
|
||||
if (strlen($key) < $len && function_exists('openssl_random_pseudo_bytes')) {
|
||||
$key .= (string) openssl_random_pseudo_bytes($len);
|
||||
$tmp = (string) openssl_random_pseudo_bytes($len, $strong);
|
||||
if ($strong) {
|
||||
$key .= $tmp;
|
||||
}
|
||||
}
|
||||
if (strlen($key) < $len) {
|
||||
throw new \Exception('Could not gather sufficient random data');
|
||||
|
|
Loading…
Add table
Reference in a new issue