最新下载
热门教程
- 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";
}
相关文章
- 无主之地4不兼容裂隙成就怎么达成 不兼容裂隙成就解锁攻略 09-18
- 地狱即我们耶尔金怎么过 第十章剧情流程视频攻略 09-18
- 地狱即我们阿卡斯高塔怎么过 第九章剧情流程视频攻略 09-18
- 地狱即我们马拉斯坦怎么过 第八章剧情流程视频攻略 09-18
- 航海王热血航线和之国罗友情技怎么选-和之国罗友情技推荐 09-18
- 我的休闲时光黑金璀璨套间怎么获得-黑金璀璨套间获取方法 09-18