Пример #1
0
 public function getAlternativeGenerator()
 {
     if (isset($this->generator)) {
         return $this->generator;
     }
     $factory = new RandomLib\Factory();
     $factory->registerSource('HashTiming', '\\SecurityMultiTool\\Random\\Source\\HashTiming');
     $this->generator = $factory->getMediumStrengthGenerator();
     return $this->generator;
 }
Пример #2
0
 /**
  * Retrieve a fallback/alternative RNG generator
  *
  * @return RandomLib\Generator
  */
 public static function getAlternativeGenerator()
 {
     if (null !== static::$generator) {
         return static::$generator;
     }
     if (!class_exists('RandomLib\\Factory')) {
         throw new Exception\RuntimeException('The RandomLib fallback pseudorandom number generator (PRNG) ' . ' must be installed in the absence of the OpenSSL and ' . 'Mcrypt extensions');
     }
     $factory = new RandomLib\Factory();
     $factory->registerSource('HashTiming', 'Zend\\Math\\Source\\HashTiming');
     static::$generator = $factory->getMediumStrengthGenerator();
     return static::$generator;
 }