Beispiel #1
0
        public void Enigma_EncryptDecrypt_Test_2()
        {
            IEnigma enigma           = new Implementations.Enigma(new RotorSet(1));
            var     encryptedMessage = enigma.EncryptMessage("E");

            encryptedMessage.Message.Should().Be("P");
            var encrypted = enigma.DecryptMessage(encryptedMessage);

            encrypted.Should().Be("E");
        }
Beispiel #2
0
        public void Enigma_EncryptDecrypt_Test()
        {
            IEnigma enigma           = new Implementations.Enigma(new RotorSet(1));
            var     encryptedMessage = enigma.EncryptMessage("ABCD");

            encryptedMessage.Message.Should().Be("UUUU");
            var decryptedMessage = enigma.DecryptMessage(encryptedMessage);

            decryptedMessage.Should().Be("ABCD");
        }
Beispiel #3
0
        public static void Main()
        {
            var rotorSet = new RotorSet(new[] { 3, 4, 5 });
            var enigma   = new Implementations.Enigma(rotorSet);

            var encrypt = enigma.EncryptMessage("ENIGMA WAS USED IN SECOND WORLD WAR");

            Console.WriteLine(encrypt.Message);    // POFNTDWAKUGUFJGVKBTZVTKLFHBRGUQDLSY

            var decrypt = enigma.DecryptMessage(encrypt);

            Console.WriteLine(decrypt);            // ENIGMA WAS USED IN SECOND WORLD WAR
        }