Skip to content

Instantly share code, notes, and snippets.

@serkanberksoy
Created April 5, 2017 11:16
Show Gist options
  • Save serkanberksoy/cebdb300143996a16a5bbd42936796c2 to your computer and use it in GitHub Desktop.
Save serkanberksoy/cebdb300143996a16a5bbd42936796c2 to your computer and use it in GitHub Desktop.
C# MD5 Generator same as JavaScript
// Working C# equivalent
public static string GetMD5Working(string input)
{
MD5 md5 = MD5.Create();
byte[] hash = md5.ComputeHash(Encoding.UTF8.GetBytes(input));
StringBuilder sb = new StringBuilder();
for (int j = 0; j < hash.Length; j++)
{
sb.Append(hash[j].ToString("X2"));
}
return sb.ToString().ToLower();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment