C#之MD5加密!...

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


//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);

        }
    }




posted @ 2012-04-09 21:22  氺〤魚Oo。  阅读(288)  评论(0编辑  收藏  举报