特色栏目

ASP源码

PHP源码

.NET源码

JSP源码

游戏频道
专题合集
关闭菜单
首页> ASP.NET教程> ASP.Net中的MD5加密

ASP.Net中的MD5加密

时间:2009-07-01 16:17:17 作者:互联网

其实在ASP.Net编程中,不用调用md5.asp来加密数据。在DotNet中有自带的类:Sy***m.Web.Security.HashPasswordForStoringInConfigFile()

public string md5(string str,int code)
{
if(code==16) //16位MD5加密(取32位加密的9~25字符)
{
return Sy***m.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower().Substring(8,16) ;
}

if(code==32) //32位加密
{
return Sy***m.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower();
}

return "00000000000000000000000000000000";
}

相关文章 最新文章

相关应用

热门文章

猜你喜欢

返回顶部