Answers for "C# get md5 of file"

C#
2

c# checksum

private static string GetMD5HashFromFile(string fileName)
{
	using (var md5 = MD5.Create())
	{
    	using (var stream = File.OpenRead(fileName))
        {
        	return BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", string.Empty);
       	}
	}
}
Posted by: Guest on March-02-2020
0

C# get md5 of file

static string CalculateMD5(string filename)
{
    using (var md5 = MD5.Create())
    {
        using (var stream = File.OpenRead(filename))
        {
            var hash = md5.ComputeHash(stream);
            return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
        }
    }
}
Posted by: Guest on August-11-2021

C# Answers by Framework

Browse Popular Code Answers by Language