Ejemplo n.º 1
0
        public void testRotors()
        {
            Rotors r1 = new Rotors();
            Rotors r2 = new Rotors();

            Console.WriteLine("-------Rotor Test-----");
            for (int i = 0; i < 26; i++)
            {
                char startLetter      = (char)('A' + i);
                char scrambledLetter  = r1.encryptLetter(startLetter);
                char unscrambleLetter = r2.decryptLetter(scrambledLetter);
                Console.WriteLine(startLetter + "->" + scrambledLetter + "->" + unscrambleLetter + ": " + (startLetter == unscrambleLetter).ToString());
            }

            Console.WriteLine("-------------------------");
        }
Ejemplo n.º 2
0
        private void FindSelectedRotors()
        {
            for (int i = 0; i < Rotors.GetLength(0); i++)
            {
                switch (Rotors[i].myCode)
                {
                case 1:
                    selectedRotors[0] = i;
                    break;

                case 2:
                    selectedRotors[1] = i;
                    break;

                case 3:
                    selectedRotors[2] = i;
                    break;
                }
            }
        }
Ejemplo n.º 3
0
 public Machine(string plugSwaps, string rotorShifts, string rotorSelection)
 {
     plugBoard.setPlugs(plugSwaps);
     rotor    = new Rotors(rotorShifts, rotorSelection);
     rotorKey = rotorShifts;
 }
Ejemplo n.º 4
0
 public void resetDefaultRotor()
 {
     rotor = new Rotors();
 }
Ejemplo n.º 5
0
 public void InsertPlugboard(Plugboard plugboard)
 {
     this.Plugboard = plugboard;
     Disc.Connect(Rotors.Last().RightDisc, this.Plugboard.LeftDisc);
 }