I am comparing two strings, one String I receive from a server with 32 characters with another one I calculate with the following code:
string getMd5(string fileName)
{
using (var md5 = MD5.Create())
{
using (var stream = File.OpenRead(fileName))
{
return BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower();
}
}
}
The problem is, that even when the two strings seems identical, the comparison fails because the string returned by the function above contains more characters than the one I receive. Please, see picture attached:
So, how do I solve this?
Thank you.