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("-------------------------"); }
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; } } }
public Machine(string plugSwaps, string rotorShifts, string rotorSelection) { plugBoard.setPlugs(plugSwaps); rotor = new Rotors(rotorShifts, rotorSelection); rotorKey = rotorShifts; }
public void resetDefaultRotor() { rotor = new Rotors(); }
public void InsertPlugboard(Plugboard plugboard) { this.Plugboard = plugboard; Disc.Connect(Rotors.Last().RightDisc, this.Plugboard.LeftDisc); }