MD5 encryption
private static string Md5hash (String input)
{
MD5CryptoServiceProvider md5hasher = new MD5CryptoServiceProvider ();
byte[] data = Md5hasher.computehash (Encoding.Default.GetBytes (input));
StringBuilder Sbuilder = new StringBuilder ();
for (int i = 0; i < data. Length; i++)
{
Sbuilder.append (Data[i]. ToString ("X2"));
}
return sbuilder.tostring ();
}
static void Main (string[] args)
{
String a = "AAAA";
String b = "China";
String c = "CCCC";
int d = 1231231;
String result1 = a + B + C + D;
String md5result11 =system.web.security.formsauthentication.hashpasswordforstoringinconfigfile (RESULT1, "MD5");
String md5result111 = Md5hash (RESULT1). ToLower ();
Console.WriteLine (md5result11);
Console.WriteLine (md5result111);
Console.readkey (); }
The resulting output is as follows:
Attention:
1, if there is no problem in converting the Chinese into English or numbers, it seems that the two methods are different for Chinese.
2,system.web.security.formsauthentication.hashpasswordforstoringinconfigfile in 4.5 has expired, that is not advocated use, but Baidu translation is still using this method of encryption to verify sign
Cause I was a long time, here really want to say that Baidu reaction really very slow ... If it is not Google by the wall, the individual feel that Baidu should be greatly reduced user volume;
If you have a better opinion, please reply directly, I am original, please self-esteem! Reprint, please come from--the breeze slowly
The last value of the two MD5 is different because the two approaches are different