最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
ASP.Net中的MD5加密
时间:2022-06-30 09:17:23 编辑:袖梨 来源:一聚教程网
其实在ASP.Net编程中,不用调用md5.asp来加密数据。在DotNet中有自带的类:System.Web.Security.HashPasswordForStoringInConfigFile()
public string md5(string str,int code)
{
if(code==16) //16位MD5加密(取32位加密的9~25字符)
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower().Substring(8,16) ;
}
if(code==32) //32位加密
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower();
}
return "00000000000000000000000000000000";
}
public string md5(string str,int code)
{
if(code==16) //16位MD5加密(取32位加密的9~25字符)
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower().Substring(8,16) ;
}
if(code==32) //32位加密
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower();
}
return "00000000000000000000000000000000";
}
相关文章
- 网站为什么需要有规律性的更新高质量文章?这么做的原因是什么? 07-03
- Figma成为最新一家申请IPO的比特币持有公司 07-03
- 魔兽世界灼热峡谷钥匙怎么获得 07-03
- Dreamweaver怎么制作鼠标点击隐藏事件? 07-03
- 炉石传说灌注星灵牧卡组构筑攻略 07-03
- 币圈:虚拟币爆仓会倒欠钱吗?需不需要赔钱? 07-03