Git Product home page Git Product logo

enigma-machine's Introduction

Enigma Machine

This is a simple project to emulate the ๐Ÿ”ก Enigma Machine ๐Ÿ”’ use Python 3

The Enigma machine is an encryption device developed and used in the early- to mid-20th century to protect commercial, diplomatic and military communication. It was employed extensively by Nazi Germany during World War II, in all branches of the German military.

---- by Wikipedia

Use

Required

python3 enigma.py

Explain

Enigma (crittografia) - Museo scienza e tecnologia Milano.jpg
By Alessandro Nassiri - Museo della Scienza e della Tecnologia "Leonardo da Vinci", CC BY-SA 4.0, Link

1. Use ๐Ÿ˜Ž

use

Press any key and the character change color in the light-board (on real model, it's all the blub ๐Ÿ’ก with characters) which is the encryt ๐Ÿ”ก result

on top of the board is roto, in the real Enigma machine, there only one number show out of the box, but I tried to make it's look like a ring :3

rotos

above of the light-board is Plug board, but if you don't plug anything, There're just input keyboard here. Don't worry about the message, you don't need plug to use this Enigma machine ๐Ÿ˜™

2. Plug board ๐Ÿ”Œ

...

The plugboard contributed more cryptographic strength than an extra rotor.

...

A cable placed onto the plugboard connected letters in pairs; for example, E and Q might be a steckered pair. The effect was to swap those letters before and after the main rotor scrambling unit. For example, when an operator pressed E, the signal was diverted to Q before entering the rotors. Up to 13 steckered pairs might be used at one time, although only 10 were normally used.

---- by Wikipedia

3. Ring settings ๐Ÿ‘Œ

The rotors (alternatively wheels or drums, Walzen in German) form the heart of an Enigma machine.

---- by Wikipedia

so if you've read the article in Wikipedia you should see that the roto have diffrent way to show up their value, diffrence by models. But all of them can be set up.

To setup in the real model, I think you gonna want to shift it by hand โœ‹. In this Enigma Machine all you need to do is enter the value which the shift times of each rings. Notice that the rotos in this python model show vertically from top to bottom โฌ (in the real model it horizontally, from left to right โžก๏ธ ).

4. Custom roto wiring ๐Ÿ”€

The mechanical parts act by forming a varying electrical circuit. When a key is pressed, one or more rotors rotate on the spindle. On the sides of the rotors are a series of electrical contacts that, after rotation, line up with contacts on the other rotors or fixed wiring on either end of the spindle. When the rotors are properly aligned, each key on the keyboard is connected to a unique electrical pathway through the series of contacts and internal wiring.

---- by Wikipedia

So that custom wiring is the things that in fact soilders never do ๐Ÿ˜ฟ. Because it's built in randomly and depends on what model of the Enigma Machine. Howerver I want to make it a little more interesting, so I add this function.

Basically, when you press A in the keyboard, the wiring lead you to another port of next roto (for example in Z port of the next, and the Z port go to the E for example and so on). So the setting gonna be "Z..." and "...E" because Z gonna be next cypher infomation for the A and E gonna be next cypher infomation for the Z. For example with this setting:

LUSHQOXDMZNAIKFREPCYBWVGTJ

a given machine configuration will encoded A to L, B to U, C to S, ..., and Z to J.

By default, the wiring of this Enigma Machine is the wiring of Commercial ๐Ÿ’ฐ Enigma which I think the simplest. You can take a look of details about roto for better explain and Roto wiring tables ๐Ÿ”€ for another model's wiring.

5. Codebook ๐Ÿ“–

A codebook is a type of document used for gathering and storing cryptography codes. Originally codebooks were often literally books, but today codebook is a byword for the complete record of a series of codes, regardless of physical format. by Wikipedia

so if you want to set up your enigma machine like a soilder, take a look at this page of codebook codebook

Date Ignore Rings settings Plug board settings Ignore too
Date of the month ๐Ÿ“†
For each day, we have diffrent settings
we don't have this setting ๐Ÿ˜…
cuz we just have 3 rotos
The shifting value
of rings by order
With a pair of characters, it's mean you should plug ๐Ÿ”Œ them together.
In this machine, you just need to type all one by one.
๐Ÿ˜…

Hope you have fun with it! โค๏ธ

enigma-machine's People

Contributors

19521225 avatar vanviethieuanh avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.