81 public static function hash($algorithm,
$data, $binaryOutput =
false)
83 $algorithm = strtolower($algorithm);
85 return $algorithm(
$data, $binaryOutput);
88 $supportedMethod =
'_digest' . ucfirst(self::$_type);
89 $result = self::$supportedMethod($algorithm,
$data, $binaryOutput);
101 if (in_array($algorithm, hash_algos())) {
107 if (in_array($algorithm, self::$_supportedAlgosMhash)) {
112 if ($algorithm ==
'ripemd160') {
113 $algorithm =
'rmd160';
116 if (in_array($algorithm, self::$_supportedAlgosOpenssl)) {
123 #require_once 'Zend/Crypt/Exception.php'; 124 throw new Zend_Crypt_Exception(
'\'' . $algorithm .
'\' is not supported by any available extension or native
function'); 133 protected static function _digestHash($algorithm, $data, $binaryOutput) 135 return hash($algorithm, $data, $binaryOutput); 144 protected static function _digestMhash($algorithm, $data, $binaryOutput) 146 $constant = constant('MHASH_
' . strtoupper($algorithm)); 147 $binary = mhash($constant, $data); 151 return bin2hex($binary); 160 protected static function _digestOpenssl($algorithm, $data, $binaryOutput) 162 if ($algorithm == 'ripemd160
') { 163 $algorithm = 'rmd160
'; 165 return openssl_digest($data, $algorithm, $binaryOutput);
static hash($algorithm, $data, $binaryOutput=false)
static _detectHashSupport($algorithm)
static $_supportedAlgosOpenssl
static $_supportedAlgosMhash