asp.net中MD5 16位和32位加密函数
程序员文章站
2023-11-27 12:29:28
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();
}
}