private char encryptLetter(char letter) { char newLetter = plugBoard.swapLetter(letter); newLetter = rotor.encryptLetter(newLetter); newLetter = plugBoard.swapLetter(newLetter); return(newLetter); }
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("-------------------------"); }