mirror of
https://github.com/danog/phpseclib.git
synced 2025-01-22 04:51:19 +01: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…
x
Reference in New Issue
Block a user