/// <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; }
时间: 2024-11-01 22:03:49