Ejemplo n.º 1
0
 /**
  * @param string $algorithm
  * @throws Zend_Crypt_Exception
  */
 protected static function _detectHashSupport($algorithm)
 {
     if (function_exists('hash')) {
         self::$_type = self::TYPE_HASH;
         if (in_array($algorithm, hash_algos())) {
             return;
         }
     }
     if (function_exists('mhash')) {
         self::$_type = self::TYPE_MHASH;
         if (in_array($algorithm, self::$_supportedAlgosMhash)) {
             return;
         }
     }
     if (function_exists('openssl_digest')) {
         if ($algorithm == 'ripemd160') {
             $algorithm = 'rmd160';
         }
         self::$_type = self::TYPE_OPENSSL;
         if (in_array($algorithm, self::$_supportedAlgosOpenssl)) {
             return;
         }
     }
     /**
      * @see Zend_Crypt_Exception
      */
     require_once 'Zend/Crypt/Exception.php';
     throw new Zend_Crypt_Exception('\'' . $algorithm . '\' is not supported by any available extension or native function');
 }