Created
August 9, 2018 20:56
-
-
Save slmcmahon/60c491dec66b7ed16fc04b986d0088af to your computer and use it in GitHub Desktop.
MD5 Hashing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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