view enigma/rotors/data.py @ 6:7a90beffd8f2

Created a data file and factory functions for rotors & reflectors.
author Brian Neal <bgneal@gmail.com>
date Sat, 26 May 2012 15:19:48 -0500
parents
children 2ce2e8c5a5be
line wrap: on
line source
# Copyright (C) 2012 by Brian Neal.
# This file is part of Py-Enigma, the Enigma Machine simulation.
# Py-Enigma is released under the MIT License (see License.txt).

"""data.py - This file contains rotor & reflector data for all the types
we simulate.

"""

# This data is taken from Dirk Rijmenants very informative and useful Enigma
# website: "Techical Details of the Engigma Machine"
# http://users.telenet.be/d.rijmenants/en/enigmatech.htm
#
# Rotors I-V were used by the Wehrmacht, Luftwaffe, and Kriegsmarine. The
# Kriegsmarine added rotors VI-VIII to the M3 model, and added Beta & Gamma to
# the M4 model (used with thin reflectors only). Note that Beta & Gamma rotors
# did not rotate.
#
# The Wehrmacht, Luftwaffe, & Kriegsmarine M3 machines used reflectors B & C,
# while the Kriegsmarine M4 used thin reflectors B & C.
#

ROTORS = {
    'I': {
        'wiring': 'EKMFLGDQVZNTOWYHXUSPAIBRCJ',
        'stepping': 'Q',
    },
    'II': {
        'wiring': 'AJDKSIRUXBLHWTMCQGZNPYFVOE',
        'stepping': 'E',
    },
    'III': {
        'wiring': 'BDFHJLCPRTXVZNYEIWGAKMUSQO',
        'stepping': 'V',
    },
    'IV': {
        'wiring': 'ESOVPZJAYQUIRHXLNFTGKDCMWB',
        'stepping': 'J',
    },
    'V': {
        'wiring': 'VZBRGITYUPSDNHLXAWMJQOFECK',
        'stepping': 'Z',
    },
    'VI': {
        'wiring': 'JPGVOUMFYQBENHZRDKASXLICTW',
        'stepping': 'ZM',
    },
    'VII': {
        'wiring': 'NZJHGRCXMYSWBOUFAIVLPEKQDT',
        'stepping': 'ZM',
    },
    'VIII': {
        'wiring': 'FKQHTLXOCBJSPDZRAMEWNIUYGV',
        'stepping': 'ZM',
    },
    'Beta': {
        'wiring': 'LEYJVCNIXWPBQMDRTAKZGFUHOS',
        'stepping': None,
    },
    'Gamma': {
        'wiring': 'FSOKANUERHMBTIYCWLQPZXVGJD',
        'stepping': None,
    },
}

REFLECTORS = {
    'B': 'YRUHQSLDPXNGOKMIEBFZCWVJAT',
    'C': 'FVPJIAOYEDRZXWGCTKUQSBNMHL',
    'B-Thin': 'ENKQAUYWJICOPBLMDXZVFTHRGS',
    'C-Thin': 'RDOBJNTKVEHMLFCWZAXGYIPSUQ',
}