Testing installation of Package
Project description
enigma_machine
A python package that allows a user to encrypt a message, simulating an enigma machine.
Examples- Simplest form
import enig
from enig import em
mac=em.Enigma_Machine()
print(mac.result("Hello, World!"))
>>> rsnyf, gidsm!
Different ways to set the rotors
import enig
from enig import em
mac=em.Enigma_Machine()
#default rotor values are 1,1,1
print(mac.rotor1,mac.rotor2,mac.rotor3)
>>> 1 1 1
mac.result("Hello, World!")
>>> rsnyf, gidsm!
#random rotors
mac.random_rotors()
>>> Your rotor number is 20 22 15
print(mac.rotors()) #Using a methord to view rotors instead of the variables directly
>>> (20, 22, 15)
mac.result("Hello, World!")
>>> wgqgt, sivcz!
#set values
mac.set_rotors_as(23,4,1)
print(mac.rotors())
>>> (23, 4, 1)
mac.result("Hello, World!")
>>> dzkzp, eywix!
Different ways to set up a plugboard
#Output without plugboard
mac.set_rotors_as(23,4,1)
print(mac.rotors())
>>> (23, 4, 1)
mac.result("Hello, World!")
>>> dzkzp, eywix!
#Setting up a plug board the long way
mac.plug_board_init({'1f': 'a', '1s': 'b', '2f': 'c', '2s': 'd', '3f': 'e', '3s': 'f', '4f': 'g', '4s': 'h', '5f': 'i', '5s': 'j', '6f': 'k', '6s': 'l', '7f': 'm', '7s': 'n', '8f': 'o', '8s': 'p', '9f': 'q', '9s': 'r', '10f': 's', '10s': 't'})
print(mac.plug_list)
>>> {'a': 'b', 'c': 'd', 'e': 'f', 'g': 'h', 'i': 'j', 'k': 'l', 'm': 'n', 'o': 'p', 'q': 'r', 's': 't'}
#Setting up the same plug board the short way
print(mac.quick_plug_board("abcdefghijklmnopqrst")) #this method also returns the dict
>>> {'1f': 'a', '1s': 'b', '2f': 'c', '2s': 'd', '3f': 'e', '3s': 'f', '4f': 'g', '4s': 'h', '5f': 'i', '5s': 'j', '6f': 'k', '6s': 'l', '7f': 'm', '7s': 'n', '8f': 'o', '8s': 'p', '9f': 'q', '9s': 'r', '10f': 's', '10s': 't'}
print(mac.plug_list)
>>> {'a': 'b', 'c': 'd', 'e': 'f', 'g': 'h', 'i': 'j', 'k': 'l', 'm': 'n', 'o': 'p', 'q': 'r', 's': 't'}
#output with plugboard
mac.set_rotors_as(23,4,1)
mac.result("Hello, World!")
>>> dnlzp, fnwjx!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
enig-0.1.2.tar.gz
(18.9 kB
view details)
File details
Details for the file enig-0.1.2.tar.gz
.
File metadata
- Download URL: enig-0.1.2.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.51.0 importlib-metadata/4.6.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cf03c14cbd277eb268c18a84c60b0ec86c462eea13d7742af07bc77b7a88d5f |
|
MD5 | 482ae7ae271e190ac0343420599f3063 |
|
BLAKE2b-256 | 7f3da4c3f8c3874461a9a79938194813c72f692bdaa76da6bc23e267472d828e |