Example #1
0
        public void DecryptButton_Click(object sender, EventArgs e)
        {
            var    ob  = new RC6();
            UInt32 key = UInt32.Parse(TextBoxKey.Text);

            ob.File    = System.Text.Encoding.Default.GetBytes(TextBoxCrypted.Text); //Подготовка данных к расшифрованию
            ob.FileLen = (uint)ob.File.Length;
            ob.Generator((UInt32)key);
            ob.Decode();                                                                        // расшифрование
            TextBoxOpenText.Text = System.Text.Encoding.Default.GetString(ob.Result.ToArray()); //Вывод на экран расшифрованных данных
        }
Example #2
0
        public void EncryptButton_Click(object sender, EventArgs e)
        {
            var    ob  = new RC6();
            UInt32 key = UInt32.Parse(TextBoxKey.Text);

            ob.File    = System.Text.Encoding.Default.GetBytes(TextBoxOpenText.Text);          // Чтение шифруемых данных
            ob.FileLen = (uint)ob.File.Length;
            ob.Generator((UInt32)key);                                                         // формирование ключа
            ob.Encode();                                                                       // шифрование
            TextBoxCrypted.Text = System.Text.Encoding.Default.GetString(ob.Result.ToArray()); //Вывод на экран зашифрованных данных
        }
Example #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            comboBox1_SelectedIndexChanged();
            if (round == 0)
            {
                round = 16;
            }
            RC6 RC = new RC6(round);

            this.label6.Text  = RC.Decrypt(this.textBox2.Text, this.textBox3.Text);
            comboBox1.Enabled = true; comboBox1.ForeColor = SystemColors.WindowText;
            textBox2.Enabled  = true; textBox2.ForeColor = SystemColors.WindowText;
            textBox3.Enabled  = true; textBox3.ForeColor = SystemColors.WindowText;
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text == "")
            {
                MessageBox.Show("请输入加密的明文"); this.textBox1.Focus(); return;
            }
            if (this.textBox3.Text == "")
            {
                MessageBox.Show("请输入加密的密钥"); this.textBox3.Focus(); return;
            }
            comboBox1_SelectedIndexChanged();
            RC6 RC = new RC6(round);

            //如果手动输入加密向量RC.IV = -1;请使用RC._IV():函数进行验证。

            textBox2.Text     = RC.Encrypt(this.textBox1.Text, this.textBox3.Text);
            comboBox1.Enabled = false; comboBox1.ForeColor = SystemColors.WindowText;
            textBox2.Enabled  = false; textBox2.ForeColor = SystemColors.WindowText;
            textBox3.Enabled  = false; textBox3.ForeColor = SystemColors.WindowText;
        }