private void button2_Click(object sender, EventArgs e) { String text = richTextBox1.Text.Replace(" ", ""); if (checkRotorNum(comboBox4.Text) && checkRotorNum(comboBox5.Text) && checkRotorNum(comboBox6.Text) && checkRotorName(comboBox1.Text) && checkRotorName(comboBox2.Text) && checkRotorName(comboBox3.Text) && text != "") { crypto xxx = new crypto(); rotaNames[] ListOne = new rotaNames[3]; ListOne[0] = (rotaChoice(comboBox1.Text)); ListOne[1] = (rotaChoice(comboBox2.Text)); ListOne[2] = (rotaChoice(comboBox3.Text)); short[] ListTwo = new short[3]; ListTwo[0] = short.Parse(comboBox4.Text); ListTwo[1] = short.Parse(comboBox5.Text); ListTwo[2] = short.Parse(comboBox6.Text); xxx.ThreeRotaSelections(ListOne, ListTwo); //if (radioButton1.Checked == true) //{ richTextBox2.Text = xxx.encrypt_sentence(richTextBox1.Text); //} //else //{ // richTextBox2.Text = xxx.decrypt_sentence(richTextBox1.Text); //} } else { MessageBox.Show("Please check rotor settings and try again. Ensure there is a message to encrypt/decrypt.", "Incorrect Format", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { crypto x = new crypto(); short[] a = new short[3]; a[0] = 1; a[1] = 1; a[2] = 1; rotaNames[] z = new rotaNames[3]; z[0] = rotaNames.rotaFour; z[1] = rotaNames.rotaOne; z[2] = rotaNames.rotaThree; x.ThreeRotaSelections(z, a); string zzzzzz = x.encrypt_sentence("Hello World!"); crypto J = new crypto(); J.ThreeRotaSelections(z, a); string xxxxx = J.decrypt_sentence("FVNNZCZKNA"); //char test = x.EncryptLetter('A'); //for (int i = 1; i <100000;i++) { // x.EncryptLetter('A'); //} }
public rota(rotaNames pass_RotaNumber, Char[] pass_AlphabetCrypto) //char of 26 letters of alaphabet (two columns) { AlphabetCrypto = new char[2, 13]; RotaNumber = pass_RotaNumber; for (int i = 0; i < 13; i++) { AlphabetCrypto[0, i] = pass_AlphabetCrypto[i]; } int count = 13; for (int i = 0; i < 13; i++) { AlphabetCrypto[1, i] = pass_AlphabetCrypto[count]; count++; } RotaPoistion = 1; }