加密算法
使用HMAC
/**
* @brief 使用HMAC
*
* @param $key 密鑰
* @param $str 源串
*
* @return 簽名值
*/
function getSignature($str
$signature = "";
if (function_exists(
$signature = base
} else {
$blocksize =
$hashfunc =
if (strlen($key) > $blocksize) {
$key = pack(
}
$key = str_pad($key
$ipad = str_repeat(chr(
$opad = str_repeat(chr(
$hmac = pack(
($key ^ $opad)
($key ^ $ipad)
)
)
)
);
$signature = base
}
return $signature;
}
From:http://tw.wingwit.com/Article/program/PHP/201311/21301.html