Answers for "C# Calculate MD5 Checksum For A File"

C#
0

C# Calculate MD5 Checksum For A File

using System.IO;
using System.Security.Cryptography.MD5;

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 July-09-2021

C# Answers by Framework

Browse Popular Code Answers by Language