C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着

    /// <summary>
    /// 生成MD5加密字符串
    /// </summary>
    /// <param name="str"></param>
    /// <param name="code"></param>
    /// <returns></returns>
    public static string CreateMd5(string str, int code)
    {
        string md5 = "";
        if (code == 16)
        {
            md5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower

().Substring(8, 16);
        }
        if (code == 32)
        {
            md5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower();
        }
        return md5;
    }

posted on 2010-10-18 11:22  王德田  阅读(304)  评论(0编辑  收藏  举报