What I'm trying to do is compare the md5 obtained from a file downloaded locally, with that from a server response. The function Md5()
It gets a string without any problem something like: 0A3958F9FCBA646A2D38412A3B9FC650
but the problem is that when comparing Comprobar()
always returns false
and when printing md5.ComputeHash(stream).ToString()
I get System.Byte[]
.
public bool Comprobar(string filename)
{
using (var md5 = MD5.Create())
{
using (var stream = File.OpenRead(filename))
{
if (Md5() == md5.ComputeHash(stream).ToString())
{
return true;
}
return false;
}
}
}