'H32', 'sha1' => 'H40'); if ( !isset($packs[$algo]) ) return false; $pack = $packs[$algo]; if (strlen($key) > 64) $key = pack($pack, $algo($key)); $key = str_pad($key, 64, chr(0)); $ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64)); $opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64)); $hmac = $algo($opad . pack($pack, $algo($ipad . $data))); if ( $raw_output ) return pack( $pack, $hmac ); return $hmac; }