py-enigma


Namepy-enigma JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryA historically accurate Enigma machine simulation library.
upload_time2025-11-08 01:40:22
maintainerNone
docs_urlNone
authorNone
requires_python>=3.2.2
licenseNone
keywords crypto cryptography simulator enigma ww2 world war 2
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =========
Py-Enigma
=========
A historically accurate Enigma Machine library written in Python 3
------------------------------------------------------------------

- **Author:** Brian Neal <bgneal@gmail.com>
- **Version:** 1.0.0
- **Date:** November 7, 2025
- **Home Page:** https://github.com/gremmie/enigma
- **License:** MIT License (see LICENSE.txt)
- **Documentation:** http://py-enigma.readthedocs.org/
- **Support:** https://github.com/gremmie/enigma/issues


Overview
--------

**Py-Enigma** is a Python 3 library for simulating the `Enigma machines`_ used
by the German armed forces (Wehrmacht) during World War 2. Py-Enigma makes it
possible to both encrypt and decrypt messages that can be sent to, or received
from, actual Enigma machines used by the German army (Heer), air force
(Luftwaffe), and navy (Kriegsmarine).

It is my hope that library will be useful to Enigma enthusiasts, historians, and
students interested in cryptography.

Py-Enigma strives to be Pythonic, easy to use, comes with unit tests, and
documentation.


Scope
-----

The current scope of Py-Enigma is to simulate Wehrmacht Enigma machines.
Simulation of other Enigmas, such as the various commercial, railroad, foreign,
and Abwher (Military Intelligence) models may come later if there is enough
interest and data available.

Currently, Py-Enigma can simulate the 3 and 4 rotor Enigma machines used by the
German army, navy, and air force.


Quick Example
-------------

This example shows how the library can be used to decode a message using the
procedure employed by the German army::
   
   from enigma.machine import EnigmaMachine

   # setup machine according to specs from a daily key sheet:

   machine = EnigmaMachine.from_key_sheet(
          rotors='II IV V',
          reflector='B',
          ring_settings=[1, 20, 11],
          plugboard_settings='AV BS CG DL FU HZ IN KM OW RX')

   # set machine initial starting position
   machine.set_display('WXC')

   # decrypt the message key
   msg_key = machine.process_text('KCH')

   # decrypt the cipher text with the unencrypted message key
   machine.set_display(msg_key)

   ciphertext = 'NIBLFMYMLLUFWCASCSSNVHAZ'
   plaintext = machine.process_text(ciphertext)

   print(plaintext)

This program prints::

   THEXRUSSIANSXAREXCOMINGX

Py-Enigma also includes a command-line application for processing messages.
Assuming you have a proper key file that contains the same initial settings as
the code above, the above example can be performed on the command-line::

   $ pyenigma --key-file=keys.txt --start=WXC --text='KCH'
   BLA
   $ pyenigma --key-file=keys.txt --start=BLA --text='NIBLFMYMLLUFWCASCSSNVHAZ'
   THEXRUSSIANSXAREXCOMINGX

The format of the key file can be found in the documentation.


Requirements
------------

Py-Enigma is written in Python_, specifically Python 3.2. It has no other
requirements or dependencies.


Installation
------------

Py-Enigma is available on the `Python Package Index`_ (PyPI). You can install it
using pip_::

   $ python3 -m pip install py-enigma

If you aren't familiar with installing Python packages, please see, for
example, the `Python Packaging Installing Packages tutorial`_.

The latest version of Py-Enigma can always be found at the `Py-Enigma GitHub page`_.


Documentation
-------------

The latest documentation is available at `Read the Docs
<http://readthedocs.org/projects/py-enigma/>`_. There you can `browse the
documentation online <http://readthedocs.org/docs/py-enigma/en/latest/>`_, or
`download it in a variety of formats
<http://readthedocs.org/projects/py-enigma/downloads/>`_.

Sources for the documentation are also included in Sphinx_ format. If you
install Sphinx you can generate the documentation in several output formats.


Support
-------

Support is provided at the `issue tracker`_ at the `Py-Enigma GitHub page`_.
If you have general questions or comments, please feel free to email me (address
at the top of this file). 

And please, if you use Py-Enigma for anything, even if it is just learning,
please let me know!


Acknowledgements & References
-----------------------------

This software would not have been possible without the thorough and detailed
descriptions of the Enigma machine on Dirk Rijmenants' incredible `Cipher
Machines and Cryptology website`_. In particular, his `Technical Details of the
Enigma Machine`_ page was a gold mine of information.

Dirk has also written an `Enigma simulator`_ in Visual Basic. Although I did not
look at his source code, I did use his simulator to check the operation of
Py-Enigma.

I would also like to recommend the photos and video at Dr. Thomas B. Perera's
`Enigma Museum`_.

Another good website is `The Enigma and the Bombe`_ by Graham Ellsbury.

A nice video which shows the basic components and operation of the Enigma
Machine is on YouTube: `Nadia Baker & Enigma demo`_.


.. _Enigma machines: http://en.wikipedia.org/wiki/Enigma_machine
.. _Python: http://www.python.org
.. _Python Package Index: http://pypi.python.org/pypi/py-enigma/
.. _Python Packaging Installing Packages tutorial: https://packaging.python.org/en/latest/tutorials/installing-packages/
.. _pip: http://pip.openplans.org/
.. _Py-Enigma GitHub page: https://github.com/gremmie/enigma
.. _Sphinx: http://sphinx.pocoo.org/
.. _issue tracker: https://github.com/gremmie/enigma/issues
.. _Cipher Machines and Cryptology website: http://users.telenet.be/d.rijmenants/index.htm
.. _Technical Details of the Enigma Machine: http://users.telenet.be/d.rijmenants/en/enigmatech.htm
.. _Enigma simulator: http://users.telenet.be/d.rijmenants/en/enigmasim.htm
.. _Enigma Museum: http://w1tp.com/enigma/
.. _The Enigma and the Bombe: http://www.ellsbury.com/enigmabombe.htm
.. _Nadia Baker & Enigma demo: http://youtu.be/HBHYAzuVeWc

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "py-enigma",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.2.2",
    "maintainer_email": null,
    "keywords": "crypto, cryptography, simulator, enigma, ww2, world war 2",
    "author": null,
    "author_email": "Brian Neal <bgneal@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e1/15/b7232e26c5d314e18b6097b421cc5b1ad8ae66b4e950d4f443f8fa3a3929/py_enigma-1.0.0.tar.gz",
    "platform": null,
    "description": "=========\nPy-Enigma\n=========\nA historically accurate Enigma Machine library written in Python 3\n------------------------------------------------------------------\n\n- **Author:** Brian Neal <bgneal@gmail.com>\n- **Version:** 1.0.0\n- **Date:** November 7, 2025\n- **Home Page:** https://github.com/gremmie/enigma\n- **License:** MIT License (see LICENSE.txt)\n- **Documentation:** http://py-enigma.readthedocs.org/\n- **Support:** https://github.com/gremmie/enigma/issues\n\n\nOverview\n--------\n\n**Py-Enigma** is a Python 3 library for simulating the `Enigma machines`_ used\nby the German armed forces (Wehrmacht) during World War 2. Py-Enigma makes it\npossible to both encrypt and decrypt messages that can be sent to, or received\nfrom, actual Enigma machines used by the German army (Heer), air force\n(Luftwaffe), and navy (Kriegsmarine).\n\nIt is my hope that library will be useful to Enigma enthusiasts, historians, and\nstudents interested in cryptography.\n\nPy-Enigma strives to be Pythonic, easy to use, comes with unit tests, and\ndocumentation.\n\n\nScope\n-----\n\nThe current scope of Py-Enigma is to simulate Wehrmacht Enigma machines.\nSimulation of other Enigmas, such as the various commercial, railroad, foreign,\nand Abwher (Military Intelligence) models may come later if there is enough\ninterest and data available.\n\nCurrently, Py-Enigma can simulate the 3 and 4 rotor Enigma machines used by the\nGerman army, navy, and air force.\n\n\nQuick Example\n-------------\n\nThis example shows how the library can be used to decode a message using the\nprocedure employed by the German army::\n   \n   from enigma.machine import EnigmaMachine\n\n   # setup machine according to specs from a daily key sheet:\n\n   machine = EnigmaMachine.from_key_sheet(\n          rotors='II IV V',\n          reflector='B',\n          ring_settings=[1, 20, 11],\n          plugboard_settings='AV BS CG DL FU HZ IN KM OW RX')\n\n   # set machine initial starting position\n   machine.set_display('WXC')\n\n   # decrypt the message key\n   msg_key = machine.process_text('KCH')\n\n   # decrypt the cipher text with the unencrypted message key\n   machine.set_display(msg_key)\n\n   ciphertext = 'NIBLFMYMLLUFWCASCSSNVHAZ'\n   plaintext = machine.process_text(ciphertext)\n\n   print(plaintext)\n\nThis program prints::\n\n   THEXRUSSIANSXAREXCOMINGX\n\nPy-Enigma also includes a command-line application for processing messages.\nAssuming you have a proper key file that contains the same initial settings as\nthe code above, the above example can be performed on the command-line::\n\n   $ pyenigma --key-file=keys.txt --start=WXC --text='KCH'\n   BLA\n   $ pyenigma --key-file=keys.txt --start=BLA --text='NIBLFMYMLLUFWCASCSSNVHAZ'\n   THEXRUSSIANSXAREXCOMINGX\n\nThe format of the key file can be found in the documentation.\n\n\nRequirements\n------------\n\nPy-Enigma is written in Python_, specifically Python 3.2. It has no other\nrequirements or dependencies.\n\n\nInstallation\n------------\n\nPy-Enigma is available on the `Python Package Index`_ (PyPI). You can install it\nusing pip_::\n\n   $ python3 -m pip install py-enigma\n\nIf you aren't familiar with installing Python packages, please see, for\nexample, the `Python Packaging Installing Packages tutorial`_.\n\nThe latest version of Py-Enigma can always be found at the `Py-Enigma GitHub page`_.\n\n\nDocumentation\n-------------\n\nThe latest documentation is available at `Read the Docs\n<http://readthedocs.org/projects/py-enigma/>`_. There you can `browse the\ndocumentation online <http://readthedocs.org/docs/py-enigma/en/latest/>`_, or\n`download it in a variety of formats\n<http://readthedocs.org/projects/py-enigma/downloads/>`_.\n\nSources for the documentation are also included in Sphinx_ format. If you\ninstall Sphinx you can generate the documentation in several output formats.\n\n\nSupport\n-------\n\nSupport is provided at the `issue tracker`_ at the `Py-Enigma GitHub page`_.\nIf you have general questions or comments, please feel free to email me (address\nat the top of this file). \n\nAnd please, if you use Py-Enigma for anything, even if it is just learning,\nplease let me know!\n\n\nAcknowledgements & References\n-----------------------------\n\nThis software would not have been possible without the thorough and detailed\ndescriptions of the Enigma machine on Dirk Rijmenants' incredible `Cipher\nMachines and Cryptology website`_. In particular, his `Technical Details of the\nEnigma Machine`_ page was a gold mine of information.\n\nDirk has also written an `Enigma simulator`_ in Visual Basic. Although I did not\nlook at his source code, I did use his simulator to check the operation of\nPy-Enigma.\n\nI would also like to recommend the photos and video at Dr. Thomas B. Perera's\n`Enigma Museum`_.\n\nAnother good website is `The Enigma and the Bombe`_ by Graham Ellsbury.\n\nA nice video which shows the basic components and operation of the Enigma\nMachine is on YouTube: `Nadia Baker & Enigma demo`_.\n\n\n.. _Enigma machines: http://en.wikipedia.org/wiki/Enigma_machine\n.. _Python: http://www.python.org\n.. _Python Package Index: http://pypi.python.org/pypi/py-enigma/\n.. _Python Packaging Installing Packages tutorial: https://packaging.python.org/en/latest/tutorials/installing-packages/\n.. _pip: http://pip.openplans.org/\n.. _Py-Enigma GitHub page: https://github.com/gremmie/enigma\n.. _Sphinx: http://sphinx.pocoo.org/\n.. _issue tracker: https://github.com/gremmie/enigma/issues\n.. _Cipher Machines and Cryptology website: http://users.telenet.be/d.rijmenants/index.htm\n.. _Technical Details of the Enigma Machine: http://users.telenet.be/d.rijmenants/en/enigmatech.htm\n.. _Enigma simulator: http://users.telenet.be/d.rijmenants/en/enigmasim.htm\n.. _Enigma Museum: http://w1tp.com/enigma/\n.. _The Enigma and the Bombe: http://www.ellsbury.com/enigmabombe.htm\n.. _Nadia Baker & Enigma demo: http://youtu.be/HBHYAzuVeWc\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A historically accurate Enigma machine simulation library.",
    "version": "1.0.0",
    "project_urls": {
        "Changelog": "https://github.com/gremmie/enigma/blob/master/CHANGELOG.md",
        "Homepage": "https://github.com/gremmie/enigma",
        "Issues": "https://github.com/gremmie/enigma/issues"
    },
    "split_keywords": [
        "crypto",
        " cryptography",
        " simulator",
        " enigma",
        " ww2",
        " world war 2"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "87f89e09eef159b20ce29a8569fbb7d1c02d2f25f10e3fdf59f9c026a0b87fdf",
                "md5": "c803e0b42d0421f12cc63c7967ad0da3",
                "sha256": "9818431b126a7602015295c7c56e2059ff59206f7aef65f5883291631f8ac9be"
            },
            "downloads": -1,
            "filename": "py_enigma-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c803e0b42d0421f12cc63c7967ad0da3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.2.2",
            "size": 28634,
            "upload_time": "2025-11-08T01:40:20",
            "upload_time_iso_8601": "2025-11-08T01:40:20.933159Z",
            "url": "https://files.pythonhosted.org/packages/87/f8/9e09eef159b20ce29a8569fbb7d1c02d2f25f10e3fdf59f9c026a0b87fdf/py_enigma-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e115b7232e26c5d314e18b6097b421cc5b1ad8ae66b4e950d4f443f8fa3a3929",
                "md5": "052bed0b565021bea209b3d9315cf4fc",
                "sha256": "95f64589388f53a34900dd711ffae7fa3c567c77eb55302a31e39f889c8e6731"
            },
            "downloads": -1,
            "filename": "py_enigma-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "052bed0b565021bea209b3d9315cf4fc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.2.2",
            "size": 25789,
            "upload_time": "2025-11-08T01:40:22",
            "upload_time_iso_8601": "2025-11-08T01:40:22.149254Z",
            "url": "https://files.pythonhosted.org/packages/e1/15/b7232e26c5d314e18b6097b421cc5b1ad8ae66b4e950d4f443f8fa3a3929/py_enigma-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-08 01:40:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gremmie",
    "github_project": "enigma",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "py-enigma"
}
        
Elapsed time: 1.30094s