我想把textbox1.text里面的值用md5加密,然后再跟textbox2.text比较大小,请问该如何去做呢?
请把如何引入命名空间也写上谢谢了!

解决方案 »

  1.   

    简单的使用头文件:using System.Web.Security;初始化数据库里的字段string strPwd=FormsAuthentication.HashPasswordForStoringInConfigFile(this.tbox_Pwd.Text,"MD5");
      

  2.   

    string outStr = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(inStr, "md5");
    //非Web项目,需要添加对System.Web的引用
      

  3.   

    System.Security.Cryptography.MD5CryptoServiceProvider _md5 = new MD5CryptoServiceProvider();
    byte[] _t1 = _md5.ComputeHash(System.Text.Encoding.Default.GetBytes(this.textBox3.Text));
    string _strT1 = BitConverter.ToString(_t1);
    byte[] _t2 = _md5.ComputeHash(System.Text.Encoding.Default.GetBytes(this.textBox4.Text));
    string _strT2 = BitConverter.ToString(_t2);
    if(_strT1==_strT2)
    {
    MessageBox.Show("OK");
    }
    else
    {
    MessageBox.Show("No");
    }
      

  4.   

    using System.Security.Cryptography;
    这个是Win下的
      

  5.   

    using System.Web.Security; 
    string text1=FormsAuthentication.HashPasswordForStoringInConfigFile(this.Text1.Text.Trim(),"MD5");
    string text2 = this.Text2.Text.Trim();
    if(text1 == text2){
        return true;
    }
    return false;