Created
June 25, 2020 18:19
-
-
Save BrunoCaimar/afe3ec98f6cb62549a01973e16c9fce6 to your computer and use it in GitHub Desktop.
MD5 e SHA256 CheckSum generation
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
public static string GetMD5Checksum(string input) | |
{ | |
using (MD5 md5 = MD5.Create()) | |
{ | |
byte[] inputBytes = Encoding.ASCII.GetBytes(input); | |
byte[] hashBytes = md5.ComputeHash(inputBytes); | |
return BitConverter.ToString(hashBytes).Replace("-", String.Empty); | |
} | |
} | |
public static string GetSha256Checksum(string input) | |
{ | |
var a = input.ToHashSet(); | |
var sha = new SHA256Managed(); | |
byte[] checksum = sha.ComputeHash(Encoding.ASCII.GetBytes(input)); | |
return BitConverter.ToString(checksum).Replace("-", String.Empty); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment