我生成的C#和Node.js的哈希字符串,但继续得到两种不同的结果...HMACSHA256在C#VS的node.js
在C#:
byte[] secretKeyBytes = Convert.FromBase64String('some_secret_key');
byte[] requestValuesSignature = Encoding.UTF8.GetBytes('teststring');
HMACSHA256 testHash = new HMACSHA256(secretKeyBytes);
byte[] = hashedBytes = testHash.ComputeHash(requestValuesSignature);
string hash1 = Convert.ToBAse64String(hashedBytes);
Console.WriteLine(hash1);
在Node.js的:
var hash2 = crypto.createHmac('SHA256', 'some_secret_key').update('teststring', 'utf8').digest('base64');
有人可以帮忙吗?
在此先感谢!
它可以帮助您提供结果,添加到问题中。 – zaph