Code documentation¶
TODO
-
class
epygma.epygma.
Epygma
(cfg_dict=None, device=None)¶ TODO
-
convert
(text)¶ Encrypt a letter or an entire text
Parameters: text (str) – the text (or letter) to encrypt Returns: the encrypted text
-
extract_cfg
()¶ Extract the rotors and steckers configuration from the complete configuration communicated
-
load_cfg
(cfg_json)¶ Load the given configuration. Start by check its schema, then if ok, create the configuration
Parameters: cfg_json (file) – the json to load
-
reset
()¶ TODO :return:
-
TODO
-
class
epygma.components.reflector.
Reflector
(model)¶ TODO
-
convert
(letter_in)¶ Convert an input letter into another through reflector. Reference is alphabet
Parameters: letter_in (str) – the letter to convert Returns: the converted letter Return type: str
-
reset
()¶ Allows to replace the rotor in its initial state
-
rotate
()¶ Simulate a rotation of the rotor and increment its counter
-
set_offset
(letter_offset)¶ Parameters: letter_offset – Returns:
-
set_start_letter
(start_letter)¶ Define on which letter rotor must be set for first convertion
Parameters: start_letter (str) – the letter on chich start the rotation
-
TODO
-
class
epygma.components.rotor.
Rotor
(model)¶ Allows to simulate a rotor and drive each rotor created
-
convert_out
(letter_in)¶ Convert a letter into another, from reflector to output. Reference is rotor.
Parameters: letter_in (str) – the letter to convert Returns: the converted letter Return type: str
-
TODO
-
class
epygma.components.stator.
Stator
(model)¶ Allows to simulate a stator and drive each rotor created
-
convert_out
(letter_in)¶ Convert a letter into another, from reflector to output. Reference is rotor.
Parameters: letter_in (str) – the letter to convert Returns: the converted letter Return type: str
-
TODO
-
class
epygma.components.scrambler.
Scrambler
(cfg_json)¶ Allows to create and simulate an assembly of rotors and a reflector, and their rotations. Scrambler contains static rotor, dynamic rotor and reflector.
-
convert
(letter_in)¶ Convert an incoming letter into another, through rotors and reflector.
Parameters: letter_in (str) – the letter to convert Returns: all the converted letters for historic Return type: list
-
reset_cfg
()¶ Allows to reset the configuration of the rotors assembly, so you can reload another one
-
TODO
-
class
epygma.components.stecker.
Stecker
(list_steckers=None)¶ This class allows to simulate Stecker of Enigma engine.
Stecker was used to invert couple of letters. Max number of Stecker: 13 (26/2)
-
convert
(letter_in)¶ Use all defined Stecker to convert letter. Check for each letter if there is an invertion. If yes, we check the following letter, else we return the last convertion.
Parameters: letter_in (str) – the letter to convert Returns: the converted letter after alls teckers Return type: str
-
get
()¶ Allows to get the inverted letters
Returns: the Stecker names and associated letters Return type: dict
-
remove
(name=None, letter=None)¶ Allows to remove a previously defined stecker by name or by letter. Name is test in first.
Parameters: - name (str) – the name of the stecker to remove
- letter (str) – the letter to disconnect. Use only if name is not defined
-
reset
()¶ Allows to remove all the set Stecker on the engine
-
set
(letter_one, letter_two, name)¶ Allows to set a new stecker. Assertion are made on letter and name, which are mandatory
Parameters: - letter_one (str) – first letter for connection
- letter_two (str) – second letter for connection
- name (str) – the name of the stecker
-