pyEnigma / README.md

pyEnigma

Python Enigma cypher machine simulator.

Presentation

Python 2 -> Python 3

Installation

$ cd pyenigma
$ sudo python setup.py install

Usage

As a Python module:

Python 3.2.3 (default, Oct 19 2012, 19:53:16) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyenigma import enigma
>>> from pyenigma import rotor
>>> print(rotor.ROTOR_GR_III)

    Name: III
    Model: German Railway (Rocket)
    Date: 7 February 1941
    Wiring: JVIUBHTCDYAKEQZPOSGXNRMWFL
>>>
>>> engr = enigma.Enigma(rotor.ROTOR_Reflector_A, rotor.ROTOR_I, rotor.ROTOR_II, rotor.ROTOR_III, key="ABC")
>>> print(engr)

    Reflector: 
    Name: Reflector A
    Model: None
    Date: None
    Wiring: EJMZALYXVBWFCRQUONTSPIKHGD
    Rotor 1: 
    Name: III
    Model: Enigma 1
    Date: 1930
    Wiring: BDFHJLCPRTXVZNYEIWGAKMUSQO
    Rotor 2: 
    Name: II
    Model: Enigma 1
    Date: 1930
    Wiring: AJDKSIRUXBLHWTMCQGZNPYFVOE
    Rotor 3: 
    Name: I
    Model: Enigma 1
    Date: 1930
    Wiring: EKMFLGDQVZNTOWYHXUSPAIBRCJ
>>> res = engr.encipher("Hellow World!")
>>> print(res)
Rkmwng Tkuvk!

Command line:

$ echo "Hello World" | ./cypher_enigma_safe.py ABC B  I II IV
Iajfb Sqguz

$ echo "Iajfb Sqguz" | ./cypher_enigma_safe.py ABC B  I II IV
Hello World

License

pyEnigma is under license.

Author

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.