Skip to content

Instantly share code, notes, and snippets.

@madd0
Created November 15, 2011 09:06
Show Gist options
  • Save madd0/1366511 to your computer and use it in GitHub Desktop.
Save madd0/1366511 to your computer and use it in GitHub Desktop.
Create an MD5 hash digest in C#
public static string MD5Hash(string toHash)
{
string hashed;
using (MD5 md5 = MD5.Create())
{
hashed = string.Join(string.Empty, md5.ComputeHash(Encoding.UTF8.GetBytes(toHash)).Select(b => b.ToString("x2")));
}
return hashed;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment