Skip to main content

An implementation of the Enigma machine in Python.

Project description

Enigma Simulator

An implementation of the Enigma machine in Python. Simulates a common 3-rotor machine with the common 8 rotors and 3 reflectors. Wikipedia has a good overview. Project inspired by this video.

The transformation of each letter is implemented as a product of permutations (Rejewski, 1980), in this case 26x26 matrices. The transform, in this formulation, can therefore be expressed as (from Wikipedia):

Enigma Transform

Can be used to encrypt/decrypt messages ('X' was used to replace spaces):

from enigma import Enigma


# Encrypting
enigma1 = Enigma(["I", "II", "III"], [0, 0, 0], [0, 0, 0], "B", "AD")
enigma1.encrypt("HELLOXWORLD") # Returns "ILBADSQQAPK"

# Decrypting
enigma2 = Enigma(["I", "II", "III"], [0, 0, 0], [0, 0, 0], "B", "AD")
enigma2.encrypt("ILBADSQQAPK") # Returns "HELLOXWORLD" back

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

enigma_simulator-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distributions

enigma_simulator-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

enigma_simulator-0.1.0-py2.py3-none-any.whl (5.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file enigma_simulator-0.1.0.tar.gz.

File metadata

  • Download URL: enigma_simulator-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0

File hashes

Hashes for enigma_simulator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a4ebf726ad57e72eec014366a951ef7f436e69e29e479e30ed7f10099cd7c6b2
MD5 db63c6323831ad852ea70371aae50ecc
BLAKE2b-256 9fcf08bef0750b6fb0319c44f6c141a6b1c9a4be25e432ba075939cdeddb2235

See more details on using hashes here.

File details

Details for the file enigma_simulator-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: enigma_simulator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0

File hashes

Hashes for enigma_simulator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae67c9b2b22b43607e8b88b41463ac0db42b12d3e82bc398d012f3fcdc3d8194
MD5 82ef2b00f0013d9c5295315616e72201
BLAKE2b-256 09025fb5379a162a4b1e22c188e20f40c37310c0060771475b4d2ddf846222a9

See more details on using hashes here.

File details

Details for the file enigma_simulator-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: enigma_simulator-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0

File hashes

Hashes for enigma_simulator-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e8ca4642c8424fad006d01ffe1b2ed3caf268ba72b57c428cc727f55a0338123
MD5 0cf4caf607cd0ee94b6f15f0bd32f193
BLAKE2b-256 54fb28a7c488ac8e6d5a93307933d34aaeaf9496929a03932e970d28bdef37e5

See more details on using hashes here.

Supported by

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