26 #require_once 'Zend/Crypt.php'; 70 'haval128',
'haval160',
'haval192',
'haval256',
'md4',
'md5',
'ripemd160',
71 'sha1',
'sha256',
'tiger',
'tiger128',
'tiger160');
94 if (!isset($key) || empty($key)) {
95 #require_once 'Zend/Crypt/Hmac/Exception.php'; 116 if (!isset($hash) || empty($hash)) {
117 #require_once 'Zend/Crypt/Hmac/Exception.php'; 121 $hash = strtolower($hash);
122 $hashSupported =
false;
125 $hashSupported =
true;
128 if ($hashSupported ===
false &&
function_exists(
'mhash') && in_array($hash, self::$_supportedAlgosMhash)) {
129 $hashSupported =
true;
132 if ($hashSupported ===
false) {
133 #require_once 'Zend/Crypt/Hmac/Exception.php'; 134 throw new Zend_Crypt_Hmac_Exception(
'hash algorithm provided is not supported on this PHP installation; please enable the hash or mhash extensions');
136 self::$_hashAlgorithm = $hash;
151 return hash_hmac(self::$_hashAlgorithm,
$data, self::$_key,
true);
153 return hash_hmac(self::$_hashAlgorithm,
$data, self::$_key);
158 return mhash(self::_getMhashDefinition(self::$_hashAlgorithm),
$data, self::$_key);
160 $bin = mhash(self::_getMhashDefinition(self::$_hashAlgorithm),
$data, self::$_key);
161 return bin2hex($bin);
175 for (
$i = 0;
$i <= mhash_count();
$i++)
177 $types[mhash_get_hash_name(
$i)] =
$i;
179 return $types[strtoupper($hashAlgorithm)];
static _hash($data, $output=self::STRING, $internal=false)
static _getMhashDefinition($hashAlgorithm)
static compute($key, $hash, $data, $output=self::STRING)
static $_supportedMhashAlgorithms
static _setHashAlgorithm($hash)