"SHA1", "HmacSHA256" => "SHA256"]; if (!array_key_exists($signMethod, $signMethodMap)) { throw new TencentCloudSDKException("signMethod invalid", "signMethod only support (HmacSHA1, HmacSHA256)"); } $signature = base64_encode(hash_hmac($signMethodMap[$signMethod], $signStr, $secretKey, true)); return $signature; } public static function signTC3($skey, $date, $service, $str2sign) { $dateKey = hash_hmac("SHA256", $date, "TC3".$skey, true); $serviceKey = hash_hmac("SHA256", $service, $dateKey, true); $reqKey = hash_hmac("SHA256", "tc3_request", $serviceKey, true); return hash_hmac("SHA256", $str2sign, $reqKey); } }