mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-02 17:52:59 +01:00
Random: $urandom -> $fp
This commit is contained in:
parent
46baf1815f
commit
5ce9ad6a42
@ -90,7 +90,7 @@ function crypt_random_string($length) {
|
||||
$fp = @fopen('/dev/urandom', 'rb');
|
||||
}
|
||||
if ($fp !== true && $fp !== false) { // surprisingly faster than !is_bool() or is_resource()
|
||||
return fread($urandom, $length);
|
||||
return fread($fp, $length);
|
||||
}
|
||||
// method 3. pretty much does the same thing as method 2 per the following url:
|
||||
// https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/ext/mcrypt/mcrypt.c#L1391
|
||||
@ -240,4 +240,4 @@ function crypt_random_string($length) {
|
||||
$result.= $r;
|
||||
}
|
||||
return substr($result, 0, $length);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user