/** * Performs a HMAC computation given relevant details such as Key, Hashing * algorithm, the data to compute MAC of, and an output format of String, * Binary notation or BTWOC. * * @param string $key * @param string $hash * @param string $data * @param string $output * @param boolean $internal * @return string */ public static function compute($key, $hash, $data, $output = self::STRING) { // set the key if (!isset($key) || empty($key)) { require_once 'Zend/Crypt/Hmac/Exception.php'; throw new Zend_Crypt_Hmac_Exception('provided key is null or empty'); } self::$_key = $key; // set the hash self::_setHashAlgorithm($hash); // perform hashing and return return self::_hash($data, $output); }