小弟看到一个加密的东东,
不知如何加密,
请高手指教。R+wt15HjHi7yB2yvZO2bPQ==  解密为123456

解决方案 »

  1.   

    应该是base64编码...Convert类里面有对应解码方法...
      

  2.   

    我看怎么跟MD5加密出来的东东很像~~~偶不是安在天的手下,实在不知道怎么直接解密~~~
    偶也很想知道单向MD5加密后如果忘了密码怎么查...期待楼下的牛人
      

  3.   

    相反 123456 加密为R+wt15HjHi7yB2yvZO2bPQ==
      

  4.   

    use CAPICOM and DES encrypt.
      

  5.   

    private void button1_Click(object sender, System.EventArgs e)
      {
       crypt=new RSACryptoServiceProvider();
       publickey=crypt.ToXmlString(false);
       richtext.Text="导出秘匙的情况下:\n"+publickey+"\n";
       privatekey=crypt.ToXmlString(true);
       string info="仅仅导出公匙的情况下:\n"+privatekey+"\n";
       richtext.AppendText(info);
       crypt.Clear();
      
      }
            //保存公匙信息
      private void button2_Click(object sender, System.EventArgs e)
      {
                   
       save=new SaveFileDialog();
       save.Filter="File Text (*.txt)|*.txt|All File (*.*)|*.*";
       save.ShowDialog();
       publicinfo=save.FileName;
       
      }
            //保存密匙信息
      private void button3_Click(object sender, System.EventArgs e)
      {
       save=new SaveFileDialog();
       save.Filter="File Text (*.txt)|*.txt|All File (*.*)|*.*";
       save.ShowDialog();
       privateinfo=save.FileName;
        
      }
      //把钥匙信息写入文件
      private void button6_Click(object sender, System.EventArgs e)
      {
        
        StreamWriter one=new StreamWriter(publicinfo,true,UTF8Encoding.UTF8);
       one.Write(publickey);
       StreamWriter two=new StreamWriter(privateinfo,true,UTF8Encoding.UTF8);
       two.Write(privatekey);
       one.Flush();
       two.Flush();
       one.Close();
       two.Close();
       MessageBox.Show("成功保存公匙和密匙!");
      
      }
            //用公匙加密
      private void button4_Click(object sender, System.EventArgs e)
      {   
       
       crypt=new RSACryptoServiceProvider();
       UTF8Encoding enc=new UTF8Encoding();
       bytes=enc.GetBytes(textBox1.Text);
       crypt.FromXmlString(  readpublickey );
        bytes = crypt.Encrypt( bytes,false );
       string encryttext=enc.GetString(bytes);//encryptbyte);
       richtext2.Text="加密结果:\n"+encryttext+"\n"+"加密结束!";  
      }  private void button5_Click(object sender, System.EventArgs e)
      {
       
       UTF8Encoding enc=new UTF8Encoding();
          byte [] decryptbyte;
       crypt.FromXmlString ( readprivatekey ) ;
       decryptbyte = crypt.Decrypt( bytes,false );
        string decrypttext=enc.GetString( decryptbyte );
       richtext3.Text = "解密结果:\n" + decrypttext + "\n" + "解密结束!" ;
      
      }
            //从文件中读取公匙信息
      private void button7_Click(object sender, System.EventArgs e)
      {
       StreamReader sr ;
       open = new OpenFileDialog( );
       open.Filter="Text File (*.txt)|*.txt|All File (*.*)|*.* ";
       // open.ShowDialog();
       if(open.ShowDialog()==DialogResult.OK)
       {
        sr = new StreamReader(open.FileName,UTF8Encoding.UTF8);
       }
       else
       {
        MessageBox.Show("发生错误!");
        return;
       }
          readpublickey = sr.ReadToEnd();
       sr.Close();  
      }
            //从文件中读取私匙信息
      private void button8_Click(object sender, System.EventArgs e)
      {
       open = new OpenFileDialog( );
       open.Filter="Text File (*.txt)|*.txt|All File (*.*)|*.* ";
       open.ShowDialog();
       StreamReader sr = new StreamReader(open.FileName,UTF8Encoding.UTF8);
          readprivatekey  = sr.ReadToEnd();
       sr.Close();  
      }