1:MD5
http://www.cmd5.com/
字節數組----字符串
//將字節數組中每個元素按照指定的編碼格式解析成字符串
//直接將數組ToString()
//將字節數組中的每個元素ToString()
//ToString("Params")
ToString("x") //可以將十進制字符串轉換為16進制字符串
ToString("X2") //為C#中的字符串格式控制符
X為 十六進制
2為 每次都是兩位數
比如 0x0A ,若沒有2,就只會輸入OxA
假設有兩個數10和26,正常情況十六進制顯示0xA ox1A,這樣看起來不整體,為了好看,可以指定"x2",這樣顯示出來就是0x0A 0x1A
參考網址: http://topic.csdn.net/t/20050709/17/4133902.html
GetMD5 方法(C#)


1 using System.Security.Cryptography; 2 3 public static string GetMD5(string str) 4 { 5 MD5 md5 = MD5.Create(); 6 byte[] buffer = Encoding.Default.GetBytes(str); 7 byte[] md5Buffer = md5.ComputeHash(buffer); 8 //return Encoding.Default.GetString(md5Buffer); 9 string strNew = string.Empty; 10 for (int i = 0; i < md5Buffer.Length; i++) 11 { 12 strNew += md5Buffer[i].ToString("X2"); 13 } 14 return strNew; 15 }
?
?