C#之MD5加密!...

来源:互联网 发布:2016淘宝刷单处罚规则 编辑:程序博客网 时间:2024/05/17 17:58

呵呵,为了便于以后使用,我封装了一个类,调用其中的方法即可得到加密后的字符串


//MD5加密类    class MD5Encryption     {        //16位MD5加密方法        public static string get16MD5(string strMD5)         {            string MD5 ="";           MD5 =System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strMD5, "MD5").Substring(8, 16);            return (MD5);        }        //32位MD5加密方法        public static string get32MD5(string strMD5)        {            string MD5="";            MD5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strMD5, "MD5");             return (MD5);        }    }




原创粉丝点击