public void SingleCharacterDeCrypt() { char expected = 'G'; NestedRotor enigma = CreateMultiRotorEnigmaMachine("AAA"); char actual = enigma.Crypt('P'); Assert.AreEqual(expected, actual); }
public void TestMethod1() { char expected = 'A'; NestedRotor enigma = CreateSingleRotorEnigmaMachine(); char actual = enigma.Crypt('A'); Assert.AreEqual(expected, actual); }
public string Crypt(string p) { StringBuilder result = new StringBuilder(); foreach (char character in p) { Advance(); char preSteckeredCharacter = _plugboard.Translate(character); char cryptedCharacter = _rotors.Crypt(preSteckeredCharacter); char postSteckeredCharacter = _plugboard.Translate(cryptedCharacter); result.Append(postSteckeredCharacter); } return(result.ToString()); }