使用System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile進行MD5加密時,會出現已過時 ...
使用System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile進行MD5加密時,會出現已過時
1 /// <summary> 2 /// 32位MD5加密 3 /// </summary> 4 /// <param name="input"></param> 5 /// <returns></returns> 6 private static string Md5Hash(string input) 7 { 8 MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider(); 9 byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input)); 10 StringBuilder sBuilder = new StringBuilder(); 11 for (int i = 0; i < data.Length; i++) 12 { 13 sBuilder.Append(data[i].ToString("x2")); 14 } 15 return sBuilder.ToString(); 16 }