вот ещё функция реализации hmac_md5($challenge,$password)function hmac_md5($data, $key='') {
if (extension_loaded('mhash')) {
if ($key== '') {
$mhash=mhash(MHASH_MD5,$data);
} else {
$mhash=mhash(MHASH_MD5,$data,$key);
}
return $mhash;
}
if (!$key) {
return pack('H*',md5($data));
}
$key = str_pad($key,64,chr(0x00));
if (strlen($key) > 64) {
$key = pack("H*",md5($key));
}
$k_ipad = $key ^ str_repeat(chr(0x36), 64) ;
$k_opad = $key ^ str_repeat(chr(0x5c), 64) ;
/* Heh, let's get recursive. */
$hmac=hmac_md5($k_opad . pack("H*",md5($k_ipad . $data)) );
return $hmac;
}