Skip to content

Instantly share code, notes, and snippets.

@elizabeth-young
Last active January 6, 2016 08:06
Show Gist options
  • Save elizabeth-young/5363072 to your computer and use it in GitHub Desktop.
Save elizabeth-young/5363072 to your computer and use it in GitHub Desktop.
Cryptography methods
public class CryptographyHelper
{
public static string CalculateMD5Hash(string value)
{
var md5 = MD5.Create();
byte[] hash = md5.ComputeHash(Encoding.ASCII.GetBytes(value.Trim()));
var sb = new StringBuilder();
foreach (byte b in hash)
{
sb.Append(b.ToString("x2"));
}
return sb.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment