zl程序教程

您现在的位置是:首页 >  其他

当前栏目

加密

2023-09-11 14:14:14 时间

引入:using System.Web.Security;

public static string md5(string password, int codeLength)
{
    if (!string.IsNullOrEmpty(password))
    {
        if (codeLength == 0x10)
        {
            return FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5").ToLower().Substring(8, 0x10);
        }
        if (codeLength == 0x20)
        {
            return FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5").ToLower();
        }
    }
    return string.Empty;
}