mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #607 from willrossi/trac6416
FIX: check GetRandom() exists for RandomGenerator.
This commit is contained in:
commit
bea58b1193
@ -47,8 +47,10 @@ class RandomGenerator {
|
||||
if($isWin && class_exists('COM')) {
|
||||
try {
|
||||
$comObj = new COM('CAPICOM.Utilities.1');
|
||||
$e = base64_decode($comObj->GetRandom(64, 0));
|
||||
return $e;
|
||||
|
||||
if(is_callable(array($comObj,'GetRandom'))) {
|
||||
return base64_decode($comObj->GetRandom(64, 0));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
}
|
||||
}
|
||||
@ -67,5 +69,4 @@ class RandomGenerator {
|
||||
function generateHash($algorithm = 'whirlpool') {
|
||||
return hash($algorithm, $this->generateEntropy());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user