Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            encryptionanddecryption en = new encryptionanddecryption();
            calculations            c  = new calculations();
            keys k = new keys();



            if (richTextBox3.Text != "" && comboBox1.Text != "")
            {
                c.Key((Convert.ToDouble(comboBox1.Text)), richTextBox3.Text);
                c.primeNumbers();
                n = c.calculatingN();
                c.totient();
                this.e            = c.checkingGCD();
                richTextBox5.Text = this.n + "," + this.e;

                double[] encryptedtext = c.encrpt();

                for (int i = 0; i < encryptedtext.Length; i++)
                {
                    richTextBox1.Text += encryptedtext[i].ToString();
                }
            }
            else
            {
                MessageBox.Show("Please enter the fields");
            }
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            encryptionanddecryption en = new encryptionanddecryption();
            calculations            c  = new calculations();
            keys k = new keys();

            /*if (richTextBox3.Text != "" && richTextBox4.Text != "")
             * {
             *
             * }
             * else
             * {
             *  MessageBox.Show("Please enter the fields");
             * }*/

            c.primeNumbers();
            c.calculatingN();
            c.totient();
            c.Key((Convert.ToDouble(comboBox1.Text)), richTextBox3.Text);
            c.checkingGCD();
            c.calculateD();

            double[] encryptedtext = c.encrpt();

            string[] decryptetext = c.dcrptn(encryptedtext);

            for (int i = 0; i < decryptetext.Length; i++)
            {
                richTextBox2.Text += decryptetext[i].ToString();
            }
        }