mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Allow RandomGenerator to use random_bytes() in PHP 7
This commit is contained in:
parent
82f62c8184
commit
05a737c5fc
@ -17,6 +17,10 @@ class RandomGenerator {
|
|||||||
* @return string Returns a random series of bytes
|
* @return string Returns a random series of bytes
|
||||||
*/
|
*/
|
||||||
public function generateEntropy() {
|
public function generateEntropy() {
|
||||||
|
if (function_exists('random_bytes')) {
|
||||||
|
return bin2hex(random_bytes(32));
|
||||||
|
}
|
||||||
|
|
||||||
$isWin = preg_match('/WIN/', PHP_OS);
|
$isWin = preg_match('/WIN/', PHP_OS);
|
||||||
|
|
||||||
// TODO Fails with "Could not gather sufficient random data" on IIS, temporarily disabled on windows
|
// TODO Fails with "Could not gather sufficient random data" on IIS, temporarily disabled on windows
|
||||||
|
Loading…
Reference in New Issue
Block a user