From 5ce9ad6a420b40b127b3dbdbe5e6fb35cbe0b4c5 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Thu, 10 Jan 2013 13:19:31 -0600 Subject: [PATCH] Random: $urandom -> $fp --- phpseclib/Crypt/Random.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpseclib/Crypt/Random.php b/phpseclib/Crypt/Random.php index 55df0bde..a60857df 100644 --- a/phpseclib/Crypt/Random.php +++ b/phpseclib/Crypt/Random.php @@ -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); -} \ No newline at end of file +}