C# convert string to MD5 hash
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();
}
Written by Jason Yost
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Md5
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#