用C#中的FormsAuthentication.HashPasswordForStoringInConfigFile 方法可以把字符串进行加密,但能不能反过来解密呢? ? 用C#中的FormsAuthentication.HashPasswordForStoringInConfigFile 方法可以把字符串进行加密,但能不能反过来解密呢? ? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 md5加密方法public string Encrypt(string password) { Byte[] clearBytes = new UnicodeEncoding().GetBytes(password); Byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes); return BitConverter.ToString(hashedBytes); } System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("要加密的字符串", System.Web.Configuration.FormsAuthPasswordFormat.MD5.ToString());参考 会员登录界面增加模块 如何给网页特殊文本框赋值 .Net Web开发中 SqlHelper的问题 [急急急] AjaxControlToolkit的问题 应用程序中的服务器错误。 DropdownList 怎么从CheckBoxList得到值 各大高手救救我! (急)asp.net在access中插入日期型数据出错! 怎么用ASP.NET做?如图 我在使用cuteeditor做在线编辑器的时候为什么有时候总时报这样的错误,但有时候又不报错,而且报错后我就重新启动计算机后也没有问题了,但 javascript 鼠标拖动IMG的问题 sql--怎么实现数据跟新呢。高手指点。。
public string Encrypt(string password)
{
Byte[] clearBytes = new UnicodeEncoding().GetBytes(password);
Byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
return BitConverter.ToString(hashedBytes);
}
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("要加密的字符串", System.Web.Configuration.FormsAuthPasswordFormat.MD5.ToString());
参考