C# SHA256Managed 如何计算空字节[]的哈希值
var sha256 = new SHA256Managed();
var hashedValue = sha256.ComputeHash(new byte[] { });
.net 如何计算空数组的哈希值?
当字节不可用时,计算哈希时会考虑什么,还是只是一个固定值?
var sha256 = new SHA256Managed();
var hashedValue = sha256.ComputeHash(new byte[] { });
How is .net able to compute hash of empty array?
When bytes are not available, what does it take into consideration while computing hash, or is it just a fixed value?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该消息经过预处理,在末尾添加“1”,然后用 0 填充,直到长度等于 448 mod 512。之后,将表示为 64 位块的消息长度附加到末尾。
因此,从空消息开始,您仍然应用预处理步骤,以执行所有位移和组合逻辑的初始输入结束。
http://csrc.nist.gov/publications/fips/fips180 -2/fips180-2withchangenotice.pdf
The message is preprocessed by adding a '1' to the end and then padding it with 0s until the length is congruent to 448 mod 512. After that the length of the message expressed as a 64 bit block is appended to the end.
So starting with an empty message you still apply the preprocessing step to end up with the initial input you perform all the bit shifting and combinatorial logic on.
http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf