当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 常用加密算法

ASP.NET
合理的网盟广告策略:如何规划与投放网盟广告
GoDaddy Backorder域名抢注经验分享
Google Analytics获得GOOGLE真正的收录网站数据指标
Visual Studio 2008 Team Suite简体中文正式版- 激活方法

ASP.NET 中的 常用加密算法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 32 ::
收藏到网摘: n/a

public static string HashCryptString(string strText,string method){
if(method == "MD5"){
strText = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strText,"MD5");
// MD5 md5 = new MD5CryptoServiceProvider();
// strText = System.Text.Encoding.UTF8.GetString(md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(strText)));
}
else if(method == "SHA1"){
strText = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strText,"SHA1");
// SHA1 sha1 = new SHA1CryptoServiceProvider();
// strText = System.Text.Encoding.UTF8.GetString(sha1.ComputeHash(System.Text.Encoding.UTF8.GetBytes(strText)));
}
return strText;
}