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
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower();
}
}
public static void Main()
{ Class1 r=new Class1();
string a=r.md5("123",32);
Console.WriteLine(a);
}
c#的md5加密
最新推荐文章于 2023-12-22 14:49:42 发布