Esempio n. 1
0
def test_enigmaCase4():
    print('\nRunning test case 4')

    # Reflector B
    # Plugboard Empty

    testNigma = crypto.Enigma(rotors={
        1: components.Rotor("VI", 0, 12),
        2: components.Rotor("VII", 0, 0),
        3: components.Rotor("VIII", 0, 0),
    },
                              reflector=components.Reflector("B"),
                              plugboard=components.Plugboard({}))

    test_input = open('tests/testCases4.txt', 'r').read().split('\n\n')

    for line in test_input:
        input_line, output_line = line.split('\n')
        assert testNigma.EDcrypt(input_line) == output_line

    print('Done!')
Esempio n. 2
0
def test_enigmaCase3():
    print('\nRunning test case 3')

    # Reflector B
    # Plugboard Empty
    # Slowest rotor grund forced to pass Z
    # Rotors with double step

    testNigma = crypto.Enigma(rotors={
        1: components.Rotor("VI", 0, 0),
        2: components.Rotor("VII", 0, 0),
        3: components.Rotor("VIII", 0, 0),
    },
                              reflector=components.Reflector("B"),
                              plugboard=components.Plugboard({}))

    test_input = open('tests/testCases3.txt', 'r').read().split('\n\n')

    for line in test_input:
        input_line, output_line = line.split('\n')
        assert testNigma.EDcrypt(input_line) == output_line

    print('Done!')