Allow RandomGenerator to use random_bytes() in PHP 7

This commit is contained in:
Loz Calver 2017-04-03 22:13:07 +01:00 committed by Sam Minnee
parent 82f62c8184
commit 05a737c5fc

View File

@ -17,6 +17,10 @@ class RandomGenerator {
* @return string Returns a random series of bytes
*/
public function generateEntropy() {
if (function_exists('random_bytes')) {
return bin2hex(random_bytes(32));
}
$isWin = preg_match('/WIN/', PHP_OS);
// TODO Fails with "Could not gather sufficient random data" on IIS, temporarily disabled on windows