Encryption algorithm:
Use HMAC-SHA1 signature method
Copy code The code is as follows:
/**
* @brief Use HMAC-SHA1 algorithm to generate oauth_signature signature value
*
* @param $key key
* @param $str source string
*
* @return signature Value
*/
function getSignature($str, $key) {
$signature = "";
if (function_exists('hash_hmac')) {
$signature = base64_encode (hash_hmac("sha1", $str, $key, true));
) > $blocksize) {
$key = pack('H*', $hashfunc($key)); );
$ipad = str_repeat(chr(0x36), $blocksize);
$opad = str_repeat(chr(0x5c), $blocksize);
$hmac = pack(
'H* ', $hashfunc(
($key ^ $opad) . pack(
'H*', $hashfunc(
($key ^ $ipad) . $str
🎜>
http://www.bkjia.com/PHPjc/327907.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/327907.html
TechArticle
Encryption algorithm: Use HMAC-SHA1 signature method to copy the code The code is as follows: /** * @brief Use HMAC-SHA1 Algorithm generates oauth_signature signature value* * @param $key key* @param $str source string...