C # Md5Hash,
/// <Summary> /// MD5 32-bit encryption (uppercase) /// </summary> /// <param name = "str"> </param> /// <returns> </returns> static string UserMd5 (string str) {string cl = str; string pwd = ""; MD5 md5 = MD5.Create (); // instantiate an md5 object. // The encrypted MD5 object is a byte array, here, you need to pay attention to Encoding UTF8/Unicode and so on. Select byte [] s = md5.ComputeHash (Encoding. UTF8.GetBytes (cl); // converts an array of the byte type to a string using a loop. This string is formatted by regular characters for (int I = 0; I <s. length; I ++) {// use the hexadecimal format of the obtained string.. The characters in the format are lowercase letters. If uppercase letters (X) are used, the characters in the format are uppercase letters pwd = pwd + s [I]. toString ("X");} return pwd ;} /// <summary> /// after MD5 16-bit encryption, the password is in lowercase /// </summary> /// <param name = "ConvertString"> </param> /// <returns> </returns> public static string GetMd5str (string ConvertString) {MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider (); string t2 = BitConverter. toString (md5.ComputeHash (UTF8Encoding. default. getBytes (ConvertString), 4, 8); t2 = t2.Replace ("-", ""); t2 = t2.ToLower (); return t2 ;} /// <summary> /// after MD5 16-bit encryption, the password is capitalized /// </summary> /// <param name = "ConvertString"> </param> /// <returns> </returns> public static string GetMd5Str (string ConvertString) {MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider (); string t2 = BitConverter. toString (md5.ComputeHash (UTF8Encoding. default. getBytes (ConvertString), 4, 8); t2 = t2.Replace ("-", ""); return t2 ;} /// <summary> /// MD5 encryption (lower case) /// </summary> /// <param name = "input"> </param> /// <returns> </returns> 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 ();}