【发布时间】:2015-10-23 19:55:36
【问题描述】:
我需要将一些 python 代码移植到 c# 中,但我在使用这一行时遇到了一些问题:
Python
hmac.new(key, message,digestmod=hashlib.sha256).digest()
C#
HMACSHA256 hm = new HMACSHA256(key);
byte[] result = hm.ComputeHash(enc.GetBytes(message));
为什么当密钥和消息相同(逐字节检查)时,我在 C# 中得到不同的结果?
【问题讨论】: