pyenigma


Namepyenigma JSON
Version 0.4.2 PyPI version JSON
download
home_pagehttps://sr.ht/~cedric/pyenigma
SummaryPython Enigma cypher machine simulator.
upload_time2024-01-07 21:58:41
maintainer
docs_urlNone
authorCédric Bonhomme
requires_python>=3.10,<4.0
licenseGPL-3.0-or-later
keywords cryptography security enigma
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyEnigma

[![builds.sr.ht status](https://builds.sr.ht/~cedric/pyenigma.svg)](https://builds.sr.ht/~cedric/pyenigma)


[pyEnigma](https://sr.ht/~cedric/pyenigma) is 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.

```bash
$ poetry install pyenigma
```

Then you can use it in your program:

```bash
$ poetry shell
(pyenigma-py3.12) $
(pyenigma-py3.12) $ python
```

```python
Python 3.12.1 (main, Dec 31 2023, 00:21:59) [GCC 12.2.0] 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 Vyzxp
```

### As a program

Install pyEnigma system wide with pipx:

```bash
$ pipx install pyenigma
```

Then you can use the command line interface:

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

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

If you want to display the rotor output state:

```bash
$ echo "Hello World" | enigma ABC A I II III "AV BS CG DL FU HZ IN KM OW RX" --verbose
Qgqop Vyzxp
KBC A I II III "AV BS CG DL FU HZ IN KM OW RX"
```

The state is returned on ```stderr```, so you can still use the Unix pipe mechanism:

```bash
$ echo "Hello World" | enigma ABC A I II III "AV BS CG DL FU HZ IN KM OW RX" --verbose | enigma ABC A I II III "AV BS CG DL FU HZ IN KM OW RX"
KBC 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](https://www.gnu.org/licenses/gpl-3.0.html)


## Author

* [Christophe Goessen](https://github.com/cgoessen) (initial author)
* [Cédric Bonhomme](https://www.cedricbonhomme.org)

            

Raw data

            {
    "_id": null,
    "home_page": "https://sr.ht/~cedric/pyenigma",
    "name": "pyenigma",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "cryptography,security,enigma",
    "author": "C\u00e9dric Bonhomme",
    "author_email": "cedric@cedricbonhomme.org",
    "download_url": "https://files.pythonhosted.org/packages/26/7c/04b4f06fb9a4bd345ec2c92edd2c873535775f7d7732bb8f264275772d5f/pyenigma-0.4.2.tar.gz",
    "platform": null,
    "description": "# pyEnigma\n\n[![builds.sr.ht status](https://builds.sr.ht/~cedric/pyenigma.svg)](https://builds.sr.ht/~cedric/pyenigma)\n\n\n[pyEnigma](https://sr.ht/~cedric/pyenigma) is a  Python Enigma cypher machine\nsimulator.\n\nFor reporting issues, visit the tracker here:\nhttps://todo.sr.ht/~cedric/pyenigma\n\n\n## Usage\n\n\n### As a Python library\n\nYou can install pyEnigma with Poetry.\n\n```bash\n$ poetry install pyenigma\n```\n\nThen you can use it in your program:\n\n```bash\n$ poetry shell\n(pyenigma-py3.12) $\n(pyenigma-py3.12) $ python\n```\n\n```python\nPython 3.12.1 (main, Dec 31 2023, 00:21:59) [GCC 12.2.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> from pyenigma import enigma\n>>> from pyenigma import rotor\n>>> print(rotor.ROTOR_GR_III)\n\n    Name: III\n    Model: German Railway (Rocket)\n    Date: 7 February 1941\n    Wiring: JVIUBHTCDYAKEQZPOSGXNRMWFL\n>>>\n>>> engine = enigma.Enigma(rotor.ROTOR_Reflector_A, rotor.ROTOR_I,\n                                rotor.ROTOR_II, rotor.ROTOR_III, key=\"ABC\",\n                                plugs=\"AV BS CG DL FU HZ IN KM OW RX\")\n>>> print(engine)\n\n    Reflector:\n    Name: Reflector A\n    Model: None\n    Date: None\n    Wiring: EJMZALYXVBWFCRQUONTSPIKHGD\n\n    Rotor 1:\n    Name: I\n    Model: Enigma 1\n    Date: 1930\n    Wiring: EKMFLGDQVZNTOWYHXUSPAIBRCJ\n    State: A\n\n    Rotor 2:\n    Name: II\n    Model: Enigma 1\n    Date: 1930\n    Wiring: AJDKSIRUXBLHWTMCQGZNPYFVOE\n    State: B\n\n    Rotor 3:\n    Name: III\n    Model: Enigma 1\n    Date: 1930\n    Wiring: BDFHJLCPRTXVZNYEIWGAKMUSQO\n    State: C\n>>> secret = engine.encipher(\"Hello World\")\n>>> print(secret)\nQgqop Vyzxp\n```\n\n### As a program\n\nInstall pyEnigma system wide with pipx:\n\n```bash\n$ pipx install pyenigma\n```\n\nThen you can use the command line interface:\n\n```bash\n$ echo \"Hello World\" | enigma ABC A  I II III \"AV BS CG DL FU HZ IN KM OW RX\"\nQgqop Vyzxp\n\n$ echo \"Qgqop Vyzxp\" | enigma ABC A  I II III \"AV BS CG DL FU HZ IN KM OW RX\"\nHello World\n```\n\nIf you want to display the rotor output state:\n\n```bash\n$ echo \"Hello World\" | enigma ABC A I II III \"AV BS CG DL FU HZ IN KM OW RX\" --verbose\nQgqop Vyzxp\nKBC A I II III \"AV BS CG DL FU HZ IN KM OW RX\"\n```\n\nThe state is returned on ```stderr```, so you can still use the Unix pipe mechanism:\n\n```bash\n$ echo \"Hello World\" | enigma ABC A I II III \"AV BS CG DL FU HZ IN KM OW RX\" --verbose | enigma ABC A I II III \"AV BS CG DL FU HZ IN KM OW RX\"\nKBC A I II III \"AV BS CG DL FU HZ IN KM OW RX\"\nHello World\n```\n\n\n## License\n\npyEnigma is licensed under\n[GNU General Public License version 3](https://www.gnu.org/licenses/gpl-3.0.html)\n\n\n## Author\n\n* [Christophe Goessen](https://github.com/cgoessen) (initial author)\n* [C\u00e9dric Bonhomme](https://www.cedricbonhomme.org)\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Python Enigma cypher machine simulator.",
    "version": "0.4.2",
    "project_urls": {
        "Homepage": "https://sr.ht/~cedric/pyenigma",
        "Repository": "https://git.sr.ht/~cedric/pyenigma"
    },
    "split_keywords": [
        "cryptography",
        "security",
        "enigma"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9df015123d696c195919ebfb42c2f2245db9591a505b04ed579a15d74aae60b9",
                "md5": "2016d2c7abbfc3cf3886d4d9ec37b1ff",
                "sha256": "e9830e037f447e5d9c6d296e513aa6be335c57148c2dc5ba24f91aec3f9a0e1f"
            },
            "downloads": -1,
            "filename": "pyenigma-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2016d2c7abbfc3cf3886d4d9ec37b1ff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 33340,
            "upload_time": "2024-01-07T21:58:39",
            "upload_time_iso_8601": "2024-01-07T21:58:39.252986Z",
            "url": "https://files.pythonhosted.org/packages/9d/f0/15123d696c195919ebfb42c2f2245db9591a505b04ed579a15d74aae60b9/pyenigma-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "267c04b4f06fb9a4bd345ec2c92edd2c873535775f7d7732bb8f264275772d5f",
                "md5": "1fe7ca04484aa7542b1051dfe8ee552f",
                "sha256": "0c1309808a71ade95d79e506a7faab3a897c0a3dc2995cec34f7a3333abd3d2c"
            },
            "downloads": -1,
            "filename": "pyenigma-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1fe7ca04484aa7542b1051dfe8ee552f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 18534,
            "upload_time": "2024-01-07T21:58:41",
            "upload_time_iso_8601": "2024-01-07T21:58:41.103471Z",
            "url": "https://files.pythonhosted.org/packages/26/7c/04b4f06fb9a4bd345ec2c92edd2c873535775f7d7732bb8f264275772d5f/pyenigma-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-07 21:58:41",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pyenigma"
}
        
Elapsed time: 0.21684s