md5加密后为什么不显示加密后的内容,显示的是我输入的密码?

解决方案 »

  1.   


    p = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(p,"MD5").ToUpper();你怎么加密的?
      

  2.   


    //偶这里有一个C#的md5产生方法.楼主看能否用得上.
             public string GetMd5Base64String(string str_input)
             {
                //得到字符串的字节形式
                byte[] data = System.Text.Encoding.Default.GetBytes(str_input);
                //得到MD5默认实例
                System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
                //得到一次MD5的哈希值
                data = md5.ComputeHash(data);
                //输出Base64
                return Convert.ToBase64String(data);
             }
      

  3.   

     public static string StringToMD5Hash(string inputString)
        {
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            byte[] encryptedBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(inputString));
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < encryptedBytes.Length; i++)
            {
                sb.AppendFormat("{0:x2}",encryptedBytes[i]);        }
            return sb.ToString();
        }
      

  4.   

    不知道有什么问题?
     string strPwd;
                //判断是否加密
                if (oCall["rdlPwd"].ToString() == "1")
                {
                    strPwd = StringToMD5Hash(oCall["txtPwd"].ToString());
                }
                else
                {
                    strPwd = oCall["txtPwd"].ToString();
                }
    这是我写的判断
      

  5.   

    一句就可以
    密文str = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(明文str, "MD5");