public static string GetMD5HashFromFile(string fileName)
{
byte[] retVal;
using (var file = new FileStream(fileName, FileMode.Open))
{
var md5 = new MD5CryptoServiceProvider();
retVal = md5.ComputeHash(file);
}
var sb = new StringBuilder();
for (var i = 0; i < retVal.Length; i++)
{
sb.Append(retVal[i].ToString("x2"));
}
return sb.ToString();
}