加密

引入: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;
}
 
posted @ 2015-04-09 16:20  ChineseMoonGod  阅读(148)  评论(0)    收藏  举报