综合

img littlehb

常用加密算法

发表于2004/10/25 13:40:00  1095人阅读

public static string HashCryptString(string strText,string method){
            if(method == "MD5"){
                strText = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strText,"MD5");
//                MD5 md5 = new MD5CryptoServiceProvider();
//              strText = System.Text.Encoding.UTF8.GetString(md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(strText)));
            }
            else if(method == "SHA1"){
                strText = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strText,"SHA1");
//                SHA1 sha1 = new SHA1CryptoServiceProvider();
//                strText = System.Text.Encoding.UTF8.GetString(sha1.ComputeHash(System.Text.Encoding.UTF8.GetBytes(strText)));
            }
            return strText;
        }
阅读全文
0 0

相关文章推荐

img
取 消
img