所以基本上我正在尝试为我制作的东西制作哈希检查器。我需要为包含文件的文件夹生成一个 md5 散列,然后将该散列与我已经拥有的散列进行比较,在这种情况下,该散列有一个指向其位置的字符串。
我不知道该怎么做,到目前为止我无法在谷歌等上找到合适的答案
这是我失败的尝试:
private async void HashChecker()
{
await Task.Run(() =>
{
//Generate Hash
byte[] TempHash = new MD5CryptoServiceProvider().ComputeHash(TempHashSource);
MD5 RealHash = MD5CryptoServiceProvider.Create(HashName);
byte[] OGHash = new MD5CryptoServiceProvider().ComputeHash(RealHash);
if (TempHash.Length == OGHash.Length)
{
int i = 0;
while ((i < TempHash.Length) && (TempHash[i] == OGHash[i]))
{
i += 1;
}
if (i == TempHash.Length)
{
HashGood = true;
}
}
});
if (HashGood == true)
{
StatusLabel.Content = "Game is Complete";
}
}
ide 当前返回:错误 CS1503 参数 1:无法从“System.Security.Cryptography.MD5”转换为“byte[]”