Created
January 4, 2013 13:49
-
-
Save ChrisMcKee/4452722 to your computer and use it in GitHub Desktop.
PHP MD5 Hash in C# Most implementations of the PHP md5() function in C# produce a different result; this produces the correct one.
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 string PHPMd5Hash(string pass) | |
{ | |
using (MD5 md5 = MD5.Create()) | |
{ | |
byte[] input = Encoding.UTF8.GetBytes(pass); | |
byte[] hash = md5.ComputeHash(input); | |
return BitConverter.ToString(hash).Replace("-", ""); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment