MD5 hexadecimal encryption and md5 hexadecimal Encryption
There are many MD5 encryption methods. Today we will talk about the MD5 hexadecimal encryption ····
Class Program {static void Main (string [] args) {// 202cb962ac59075b964b07152d234b70 string s = GetMD5 ("123"); Console. writeLine (s); Console. readKey ();} /// <summary> /// MD5 hexadecimal encryption /// </summary> /// <param name = "str"> string to be encrypted </param> /// <returns> string returned after encryption </returns> public static string GetMD5 (string str) {// create the MD5 object MD5 = MD5.Create (); // start encryption // convert the character to a byte array byte [] buffer = Encoding. default. getBytes (str); // returns an encrypted byte array byte [] MD5Buffer = md5.ComputeHash (buffer); // converts a byte array to a string strNew = ""; for (int I = 0; I <MD5Buffer. length; I ++) {strNew + = MD5Buffer [I]. toString ("x2") ;}return strNew ;}}
You can use the GetMD5 method to obtain the desired MD5 hexadecimal encryption.