0
VB.net代碼:PHP hash_hmac無法獲得相同的結果vb.net結果HMACSHA
Function HMACSHA(ByVal Key As String, ByVal Value As String)
Dim objHMAC As New HMACSHA1(Encoding.ASCII.GetBytes(Key))
HMACSHA_Encrypt = (objHMAC.ComputeHash(Encoding.ASCII.GetBytes(Value)))
End Function
例
Key e.g. 「RHBNow」
Value e.g. 「7090982.885183」 based on custom hash algorithms
Hash value e.g. bcf370bcbb6248c4d718ec17e5c6982477744f6a
PHP的:
$ha1='RHBNow';
$ha2=7090982.885183;
$binarySignature = base64_encode(hash_hmac('sha1',$ha1,$ha2, true));
$urlSafeSignature = urlencode($binarySignature);
結果:
PS7%2FPqt95CtEEGeNsNOV1y%2FEaQ4%3D
無法獲得與vb.net結果相同的結果。