mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-06-01 16:10:51 +00:00
Use random_compat
This commit is contained in:
parent
2ae82a1bc7
commit
1ca62c2c33
|
@ -51,6 +51,7 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"paragonie/random_compat": "^1.4",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
|
@ -46,7 +46,7 @@ class Random
|
|||
*/
|
||||
static function string($length)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
|
||||
if (version_compare(PHP_VERSION, '7.0.0', '>=') || defined('RANDOM_COMPAT_READ_BUFFER')) {
|
||||
try {
|
||||
return \random_bytes($length);
|
||||
} catch (\Throwable $e) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user