最新下载
热门教程
- 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";
}
相关文章
- 《超能力冲刺》水风阵容怎么配队 06-16
- 《晶核》平民职业选择推荐细节解读 06-16
- 2025盘点正规币圈十大比特币交易平台TOP10-去中心化加密货币交易所币安app推荐 06-16
- 《花亦山心之月》社团等级提升较好的方法 06-16
- BALL币如何安全存储-2025币安交易所存储教程 06-16
- 币安期权是美式还是欧式 2025期权交易模式全解析 06-16