如何在ASP.net中密码的加密

如题所述

第1个回答  2012-06-05
public static string GetMD5HashHex(String input)
{
MD5 md5 = new MD5CryptoServiceProvider();
DES des = new DESCryptoServiceProvider();
byte[] res = md5.ComputeHash(Encoding.Default.GetBytes(input), 0, input.Length);

String returnThis = "";

for (int i = 0; i < res.Length; i++)
{
returnThis += System.Uri.HexEscape((char)res[i]);
}
returnThis = returnThis.Replace("%", "");
returnThis = returnThis.ToLower();

return returnThis;

}
第2个回答  2012-06-05
直接用MD5进行加密解密就行了
第3个回答  2012-06-05
cmd.Parameters["@password"].Value = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str_pwd, "MD5").ToString();
相似回答
大家正在搜