/// <summary> /// 獲取32位MD5加密字符串(已補完0) /// </summary> /// <param name="strWord"></param> /// <returns></returns> public static string GetMD5String(string strWord) { string strRes = string.Empty; MD5 md5 = MD5.Create(); byte[] fromData = System.Text.Encoding.UTF8.GetBytes(strWord); byte[] targetData = md5.ComputeHash(fromData); for (int i = 0; i < targetData.Length; i++) { strRes += targetData[i].ToString("x2");//x不補0,x2把0補齊,X為大寫 } return strRes; }