怎么得到Hmac-SHA256原始二进制?有没有大老做过???
按下面的代码算法得到的结果后在线验证,只能得到下图的1,2(https://1024tools.com/hmac)
我要得到下图3的结果,
先谢谢了
uses
IdGlobal, IdHashSHA, IdHMAC, IdHMACSHA1, IdSSLOpenSSL;
function CalculateHMACSHA256_64(const value, salt: String): String;
var
hmac: TIdHMACSHA256;
hash: TIdBytes;
begin
LoadOpenSSLLibrary;
if not TIdHashSHA256.IsAvailable then
raise Exception.Create('SHA256 hashing is not available!');
hmac := TIdHMACSHA256.Create;
try
hmac.Key := IndyTextEncoding_UTF8.GetBytes(salt);
hash := hmac.HashValue(IndyTextEncoding_UTF8.GetBytes(value));
Result := ToHex(hash);
Result :=EncodeString(Result );
finally
hmac.Free;
end;
end;