最新下载
热门教程
- 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";
}
相关文章
- 最好用的韩漫app有哪些-免费高清韩漫阅读app下载推荐 12-27
- 微信文件传输助手网页版入口-官方网页版入口地址 12-27
- 小肥羊漫画手机版下载安装免费 - 小肥羊漫画手机版下载最新版本 12-27
- SKR到底啥意思?SKR这个梗怎么火起来的 12-27
- 百度搜题网页版入口在哪找-百度网页版搜题入口直达 12-27
- beautybox最新版本下载-beautybox安卓安装包下载 12-27