Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FIX: check GetRandom() exists for RandomGenerator

  • Loading branch information...
commit a4ff1d3613483e852851f73b2a7fc71f0012ed8e 1 parent 23ed533
@halkyon halkyon authored wilr committed
Showing with 6 additions and 5 deletions.
  1. +6 −5 security/RandomGenerator.php
View
11 security/RandomGenerator.php
@@ -47,8 +47,10 @@ function generateEntropy() {
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) {
}
}
@@ -66,6 +68,5 @@ function generateEntropy() {
*/
function generateHash($algorithm = 'whirlpool') {
return hash($algorithm, $this->generateEntropy());
- }
-
-}
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.