-2
hash_hmac的
我想转换下面的PHP代码到Python的Python相当于在PHP
"<?php echo(strtoupper(hash_hmac('SHA256', $hashinput, pack('H*',$securesecret)))); ?>"
,这就是我来到了
base64.b64encode(hmac.new(bytearray(securesecret.upper(), "ASCII") bytearray(hashInput.rstrip('&'),"ASCII") , hashlib.sha512).digest())).decode("ASCII").replace("\n", "").upper())
但它不工作?
你能描述一下*它如何不工作,提供输入的例子,实际的输出和预期的输出? – Tagc