Ejemplo n.º 1
0
        //method to change the rotors that are used
        public void ChangeRotors(string rot1,string rotName1,char rotNotch1,
		                         string rot2,string rotName2,char rotNotch2,
		                         string rot3,string rotName3,char rotNotch3)
        {
            lblRotorS.Text = rotName1;
            lblRotorM.Text = rotName2;
            lblRotorD.Text = rotName3;
            rr = null;
            rm = null;
            rl = null;

            rr = new Rotor(rot3,lblRotor1,rotNotch3);
            rm = new Rotor(rot2,lblRotor2,rotNotch2);
            rl = new Rotor(rot1,lblRotor3,rotNotch1);

            rr.ResetOffset();
            rm.ResetOffset();
            rl.ResetOffset();

            rr.SetNextRotor(rm);
            rm.SetNextRotor(rl);
            rl.SetNextRotor(reflector);
            rm.SetPreviousRotor(rr);
            rl.SetPreviousRotor(rm);
            reflector.SetPreviousRotor(rl);

            lblRotor1.Text = "A";
            lblRotor2.Text = "A";
            lblRotor3.Text = "A";
        }
Ejemplo n.º 2
0
        public EnigmaForm()
        {
            InitializeComponent();
            rr = new Rotor("BDFHJLCPRTXVZNYEIWGAKMUSQO", label2, 'V', "RR");
            rm = new Rotor("AJDKSIRUXBLHWTMCQGZNPYFVOE", label3, 'E', "RM");
            rl = new Rotor("EKMFLGDQVZNTOWYHXUSPAIBRCJ", label5, 'Q', "RL");
            reflector = new Rotor("YRUHQSLDPXNGOKMIEBFZCWVJAT", null, '\0', "reflector");

            //J,Z

            rr.SetNextRotor(rm);
            rm.SetNextRotor(rl);
            rl.SetNextRotor(reflector);
            rm.SetPreviousRotor(rr);
            rl.SetPreviousRotor(rm);
            reflector.SetPreviousRotor(rl);
        }
Ejemplo n.º 3
0
        public Enigma(int rotorsCount, int rotorsLayout, int[] offsets)
        {
            r1 = new Rotor("BDFHJLCPRTXVZNYEIWGAKMUSQO", 'V');
            r2 = new Rotor("AJDKSIRUXBLHWTMCQGZNPYFVOE", 'E');
            r3 = new Rotor("EKMFLGDQVZNTOWYHXUSPAIBRCJ", 'Q');
            r4 = new Rotor("NQDJXVLSPHUFACKOIYRWZMEBGT", 'Q');
            r5 = new Rotor("CKPESOHXVUMJRFYALGQBTIDZWN", 'Q');
            reflector = new Rotor("YRUHQSLDPXNGOKMIEBFZCWVJAT", '\0');

            //J,Z

            r1.SetNextRotor(r2);
            r2.SetNextRotor(r3);
            r3.SetNextRotor(reflector);
            r2.SetPreviousRotor(r1);
            r3.SetPreviousRotor(r2);
            reflector.SetPreviousRotor(r3);
        }
Ejemplo n.º 4
0
        void MainFormLoad(object sender, System.EventArgs e)
        {
            rr = new Rotor("BDFHJLCPRTXVZNYEIWGAKMUSQO",lblRotor1,'V');
            rm = new Rotor("AJDKSIRUXBLHWTMCQGZNPYFVOE",lblRotor2,'E');
            rl = new Rotor("EKMFLGDQVZNTOWYHXUSPAIBRCJ",lblRotor3,'Q');
            reflector = new Rotor("YRUHQSLDPXNGOKMIEBFZCWVJAT",null,'\0');

            //J,Z

            rr.SetNextRotor(rm);
            rm.SetNextRotor(rl);
            rl.SetNextRotor(reflector);
            rm.SetPreviousRotor(rr);
            rl.SetPreviousRotor(rm);
            reflector.SetPreviousRotor(rl);
        }