Skip to content

Instantly share code, notes, and snippets.

@slmcmahon
Created August 9, 2018 20:56
Show Gist options
  • Save slmcmahon/60c491dec66b7ed16fc04b986d0088af to your computer and use it in GitHub Desktop.
Save slmcmahon/60c491dec66b7ed16fc04b986d0088af to your computer and use it in GitHub Desktop.
MD5 Hashing
using System;
using System.IO;
using System.Security.Cryptography;
namespace Security
{
public class SecurityUtils
{
public static string ComputeChecksum(string filePath)
{
using (var md5 = MD5.Create())
{
using (var stream = File.OpenRead(filePath))
{
return Convert.ToBase64String(md5.ComputeHash(stream));
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment