【发布时间】:2012-02-18 19:00:00
【问题描述】:
如何比较 Dllcache 和 system32/drivers 文件夹中同名的 2 个 sys 文件,以判断 system32/drivers 中的 sys 文件是否损坏?使用 c#(md5 checksum or crc32 or ...)
【问题讨论】:
-
@ken2k - 他们今天发布的previous question 包含他的尝试。
如何比较 Dllcache 和 system32/drivers 文件夹中同名的 2 个 sys 文件,以判断 system32/drivers 中的 sys 文件是否损坏?使用 c#(md5 checksum or crc32 or ...)
【问题讨论】:
你可以比较他们的SHA1 hashes:
public string ComputeHash(string filename)
{
using(var sha1 = new SHA1CryptoServiceProvider())
{
byte[] fileData = File.ReadAllBytes(filename);
string hash = BitConverter.ToString(sha1.ComputeHash(fileData));
}
}
【讨论】: