Re: [徵求] PHP5 > function mhash()

看板PHP作者 (觸不到的戀人(b))時間18年前 (2007/07/12 10:18), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《tirme (Tirme)》之銘言: : 我在網路上看有人說PHP5不支援mhash : 我使用PHP5.2.1版(appserv2.5.7 win32) : 解開php.ini的extension=php_mhash.dll 並且restart了 : 但是仍然無法找到function mhash() : 請問有辦法解決嗎? : 感謝幫忙 php官方就有人有寫好的函式可以用了 ~~ function hmac ($key, $data) { // RFC 2104 HMAC implementation for php. // Creates an md5 HMAC. // Eliminates the need to install mhash to compute a HMAC // Hacked by Lance Rushing $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack("H*",md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad ; $k_opad = $key ^ $opad; return md5($k_opad . pack("H*",md5($k_ipad . $data))); } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.132.101.76
文章代碼(AID): #16bOzdnA (PHP)
討論串 (同標題文章)
文章代碼(AID): #16bOzdnA (PHP)