Skip to main content

Python Enigma cypher machine simulator.

Project description

pyEnigma

builds.sr.ht status

pyEnigma, a Python Enigma cypher machine simulator.

For reporting issues, visit the tracker here: https://todo.sr.ht/~cedric/pyenigma

Usage

As a Python library

You can install pyEnigma with Poetry.

$ poetry install pyenigma

Then you can use it in your program:

$ poetry shell
(pyenigma-X0xzv6Ge-py3.8) $
(pyenigma-X0xzv6Ge-py3.8) $ python
Python 3.8.0 (default, Dec 11 2019, 21:43:13)
[GCC 9.2.1 20191008] on linux
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
>>>
>>> engine = enigma.Enigma(rotor.ROTOR_Reflector_A, rotor.ROTOR_I,
                                rotor.ROTOR_II, rotor.ROTOR_III, key="ABC",
                                plugs="AV BS CG DL FU HZ IN KM OW RX")
>>> print(engine)

    Reflector:
    Name: Reflector A
    Model: None
    Date: None
    Wiring: EJMZALYXVBWFCRQUONTSPIKHGD

    Rotor 1:
    Name: I
    Model: Enigma 1
    Date: 1930
    Wiring: EKMFLGDQVZNTOWYHXUSPAIBRCJ
    State: A

    Rotor 2:
    Name: II
    Model: Enigma 1
    Date: 1930
    Wiring: AJDKSIRUXBLHWTMCQGZNPYFVOE
    State: B

    Rotor 3:
    Name: III
    Model: Enigma 1
    Date: 1930
    Wiring: BDFHJLCPRTXVZNYEIWGAKMUSQO
    State: C
>>> secret = engine.encipher("Hello World")
>>> print(secret)
Qgqop Vwoxn

As a program

Install pyEnigma system wide with pipx:

$ pipx install pyenigma

Then you can use the command line interface:

$ echo "Hello World" | enigma ABC A  I II III "AV BS CG DL FU HZ IN KM OW RX"
Qgqop Vwoxn

$ echo "Qgqop Vwoxn" | enigma ABC A  I II III "AV BS CG DL FU HZ IN KM OW RX"
Hello World

License

pyEnigma is licensed under GNU General Public License version 3

Author

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyenigma-0.2.2.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyenigma-0.2.2-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file pyenigma-0.2.2.tar.gz.

File metadata

  • Download URL: pyenigma-0.2.2.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.8.0 Linux/5.3.0-24-generic

File hashes

Hashes for pyenigma-0.2.2.tar.gz
Algorithm Hash digest
SHA256 daa53eb0b279c3555c493b7ccaea9203ad219c8e6f1e07f1fd13cd626702b3af
MD5 819a495653a245e84306077e7e800ab0
BLAKE2b-256 8617408d9213fb0acff75d8055f276e7dff5c25493c96f1715b6c30f35a41f60

See more details on using hashes here.

File details

Details for the file pyenigma-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pyenigma-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 32.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.8.0 Linux/5.3.0-24-generic

File hashes

Hashes for pyenigma-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 afc2487aa2f11f787ed4b088dbbb59600a79c0aa6262eab0393818492afbacb0
MD5 644fd3ecaa6846263f65c206a0a281dd
BLAKE2b-256 8c83a4dddb8263d24c8d476f8e01121cfedb9d7dc90653743254a6a007c116e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page