php代码
function get_signature($data, $secret_key) {
$algo = "sha512";
$result = hash_hmac(
$algo,
$data,
$secret_key,
false
);
return $result;
}
python code (Tried)
def get_signature(data, secret_key):
signature = hmac.new(secret_key.encode(), data.encode(), hashlib.sha512).hexdigest()
print(signature)
return signature
散列值不相同。我怎么能得到相同的值在php代码从python代码?
谢谢!
代码工作正常。问题发生在另一个代码上。