Created
June 17, 2019 11:30
-
-
Save faridprogrammer/20d89b7b4ff350cdab1aad9e4b0f0515 to your computer and use it in GitHub Desktop.
Simple security helper
This file contains 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 class SecurityHelper | |
{ | |
public static string MD5Hash(string input) | |
{ | |
StringBuilder hash = new StringBuilder(); | |
MD5CryptoServiceProvider md5provider = new MD5CryptoServiceProvider(); | |
byte[] bytes = md5provider.ComputeHash(new UTF8Encoding().GetBytes(input)); | |
for (int i = 0; i < bytes.Length; i++) | |
{ | |
hash.Append(bytes[i].ToString("x2")); | |
} | |
return hash.ToString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment