【发布时间】:2013-08-07 21:00:40
【问题描述】:
使用以下代码,无论输入如何,我总是得到相同的哈希值。任何想法为什么会这样?
private static SHA256 sha256;
internal static byte[] HashForCDCR(this string value)
{
byte[] hash;
using (var myStream = new System.IO.MemoryStream())
{
using (var sw = new System.IO.StreamWriter(myStream))
{
sw.Write(value);
hash = sha256.ComputeHash(myStream);
}
}
return hash;
}
【问题讨论】: