asp.net中MD5 16位和32位加密函数
程序员文章站
2022-07-19 16:51:07
public string md5(string str,int code) { &...
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) ;
}
else//32位加密
{
return system.web.security.formsauthentication.hashpasswordforstoringinconfigfile(str,"md5").tolower();
}
}
{
if(code==16) //16位md5加密(取32位加密的9~25字符)
{
return system.web.security.formsauthentication.hashpasswordforstoringinconfigfile(str,"md5").tolower().substring(8,16) ;
}
else//32位加密
{
return system.web.security.formsauthentication.hashpasswordforstoringinconfigfile(str,"md5").tolower();
}
}
上一篇: ASP.NET 2.0下随机读取Access记录的实现方法
下一篇: 互联网产品运营中的用户认识误区