Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/panagiotiskots/enigma-machine-simulator
A C-based simulation of the Enigma machine encryption process
https://github.com/panagiotiskots/enigma-machine-simulator
c cryptography encryption encryption-algorithms encryption-decryption enigma enigma-machine enigma-simulator history
Last synced: 22 days ago
JSON representation
A C-based simulation of the Enigma machine encryption process
- Host: GitHub
- URL: https://github.com/panagiotiskots/enigma-machine-simulator
- Owner: PanagiotisKots
- Created: 2024-07-17T07:34:02.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-07T13:34:20.000Z (4 months ago)
- Last Synced: 2024-09-08T15:10:47.739Z (4 months ago)
- Topics: c, cryptography, encryption, encryption-algorithms, encryption-decryption, enigma, enigma-machine, enigma-simulator, history
- Language: C
- Homepage:
- Size: 386 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ก๏ธ Enigma Machine Simulator
A C-based simulation of the Enigma machine encryption.
The Enigma machine is one of the most famous encryption devices in history, used extensively by Nazi Germany during World War II. It became a symbol of cryptographic warfare due to the significant efforts made by the Allies to crack its codes.
---
## ๐ ๏ธ Early Development
### ๐จ Invention
- **Inventor**: German engineer Arthur Scherbius.
- **Year**: Patented in 1918, shortly after World War I.
- **Purpose**: Initially designed for commercial use to secure corporate communications.### ๐ผ Commercial Models
- **1920s**: Early commercial Enigma models marketed to banks and businesses.
- These models werenโt commercially successful but demonstrated the potential of mechanical encryption devices.---
## โ๏ธ Military Adoption
### ๐ช German Military Interest
- By the **late 1920s** and **early 1930s**, the German military recognized Enigmaโs potential for secure communications.
- The military **modified** and enhanced the machine to increase security, adding:
- Additional **rotors**.
- The **plugboard** for added complexity.### ๐ Usage During WWII
- Enigma became the **primary encryption device** for the German **Army**, **Navy**, **Air Force**, and intelligence services.
- It was believed to be **unbreakable** due to its **complex encryption methods**.## ๐ง The Enigma Machine Design
| **Component** | **Description** |
|-------------------------------|-------------------------------------------------------------------------------------|
| โ๏ธ **Rotors (Wheels)** | Rotating disks that scrambled the input letters. |
| ๐ **Reflector (Umkehrwalze)** | Reflected signals back through the rotors, ensuring bidirectional encryption. |
| ๐ **Plugboard (Steckerbrett)** | Allowed additional letter substitutions for extra complexity. |
| โจ๏ธ **Keyboard** | Used by the operator to type plaintext messages. |
| ๐ก **Lampboard** | Lit up the encrypted letters in response to each keypress. |### โ๏ธ Operation
- Each keypress caused the rotors to move, altering the encryption path for each letter.
- The plugboard provided an additional layer of substitution before and after the signal passed through the rotors.---
## ๐ง Breaking the Enigma
### ๐ต๐ฑ Polish Efforts
- The first major breakthroughs in cracking Enigma came from **Polish cryptanalysts** in the 1930s.
- Mathematicians **Marian Rejewski**, **Jerzy Rรณลผycki**, and **Henryk Zygalski** applied mathematical techniques to study the Enigmaโs structure.
- They built early mechanical devices, such as the "**bombe**", to help decipher Enigma messages.### ๐ฌ๐ง Transfer to the Allies
- In **1939**, just before World War II, Polish cryptanalysts shared their knowledge with **British** and **French intelligence services**.
- This transfer was crucial for further Allied code-breaking efforts.### ๐ฐ Bletchley Park
- During World War II, **Bletchley Park** became the hub of Allied cryptanalysis.
- **Alan Turing**, along with **Gordon Welchman** and others, developed advanced versions of the **bombe** machine to automate the decryption of Enigma-encoded messages.### ๐ต๏ธ Impact on the War
- The successful decryption of Enigma-encoded messages, known as "**Ultra**" intelligence, gave the Allies insight into German military operations.
- Historians widely believe that Ultra **shortened the war** and saved countless lives.## ๐ Post-War and Legacy
### ๐ Secrecy and Declassification
- The work at **Bletchley Park** remained highly classified until the **1970s**.
- The full extent of the Enigma and code-breaking efforts was not revealed to the public until much later.### ๐๏ธ Historical Significance
- The **Enigma machine** has become an iconic symbol in the history of **cryptography** and **warfare**.
- Its story has been the subject of numerous **books**, **documentaries**, and **films**, showcasing the intersection of **technology**, **mathematics**, and **military intelligence**.### ๐ Additional Resources
- Learn more about **Alan Turing** and the efforts to crack the Enigma code: [**Bletchley Park**](https://bletchleypark.org.uk)
- For an in-depth look at the mathematics behind the Enigma: [**The Bombe Machine**](https://en.wikipedia.org/wiki/Bombe)---
The **Enigma machine** remains a monumental feat of encryption technology and a critical turning point in the history of cryptography. Its story not only highlights the challenges of secure communications but also the power of human ingenuity in solving complex problems.
# The Programm
A **C-based simulation** of the historic Enigma machine, demonstrating the encryption process used in this iconic ciphering device. The simulator replicates the step-by-step mechanics of the original machine, allowing users to follow each encryption stage in detail.
## ๐ Features
- **Full Enigma encryption simulation** including rotor and reflector behavior.
- **Detailed step-by-step output**, displaying the encryption process for each letter.
- **Customizable rotor positions** for flexible configurations and experimentation.
- Easy-to-follow structure with **explanations of each encryption stage** in the output.## ๐ ๏ธ Installation
1. **Clone the repository**:
git clone https://github.com/PanagiotisKots/Enigma-Machine-Simulator.git
Navigate to the project directory:
cd Enigma-Machine-Simulator
Compile the code:
gcc -o enigma Enigma.c
๐ Usage
To run the Enigma machine simulation:
./enigma.exe
The program will prompt you to enter a message, after which it will display a step-by-step encryption process and the final encrypted message.
โ๏ธ How It Works
Key ComponentsRotors: Rotating disks that map input letters to other letters. Their positions shift with each key press, dynamically changing the encryption path.
Reflector: Reflects the signal back through the rotors, adding a second encryption pass.
Plugboard: (Not implemented in this version) Would allow additional letter substitutions for even greater complexity.Encryption Process
Forward Pass Through Rotors: Each input letter is passed through the sequence of rotors, with the rotor positions shifting based on prior encryptions.
Reflection: The letter is then reflected back through the rotors, further scrambling the signal.
Backward Pass Through Rotors: The reflected letter is passed again through the rotors in reverse order.
Rotor Stepping: After each letter, the rotors step, changing their positions and modifying the encryption for the next input.Example Encryption Output
The program prints out detailed steps for each character's encryption:
Encrypting character: A
Initial Rotor Positions: [0, 0, 0]
After Rotor 1: E
After Rotor 2: K
After Rotor 3: Z
After Reflector: R
Back through Rotor 3: X
Back through Rotor 2: P
Back through Rotor 1: G
Encrypted character: G๐ Rotor Positioning
The rotor stepping mechanism advances the rotors after each key press, creating a different encryption pattern for each character. You can reset the rotor positions manually or modify them for specific use cases, providing flexibility in your encryption tests.
๐ง CustomizationYou can easily customize the rotor configurations and starting positions by modifying the code, making it possible to explore different encryption patterns and behaviors.
| ๐ ๏ธ **Feature** | ๐ก **Difficulty Level** | ๐ **Complexity** | ๐ง **Breaking Difficulty** |
|-----------------------------|-------------------------|----------------------|----------------------------|
| โ๏ธ **Rotors Mechanism** | ๐ข Basic Implementation | ๐น Moderate | ๐ก Medium |
| ๐ **Rotor Stepping** | ๐ก Intermediate | ๐ธ High | ๐ Challenging |
| ๐ **Plugboard (Steckerbrett)** | ๐ด Advanced | ๐ป Very High | ๐ด High |
| ๐ **Reflector (Umkehrwalze)** | ๐ข Basic Implementation | ๐น Moderate | ๐ Challenging |
| ๐ **Encryption Process** | ๐ก Intermediate | ๐ธ High | ๐ Challenging |
| ๐งฎ **Mathematical Model** | ๐ด Advanced | ๐ป Very High | ๐ด High |
| ๐ **Overall Decryption** | ๐ด Very Advanced | ๐ป Complex | ๐ด Very High || ๐ ๏ธ **Component** | ๐ธ **Image** | ๐ **Description** |
|-----------------------------|-----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
| โ๏ธ **Enigma Machine** | ![Enigma Machine](https://upload.wikimedia.org/wikipedia/commons/thumb/b/bd/Enigma_%28crittografia%29_-_Museo_scienza_e_tecnologia_Milano.jpg/220px-Enigma_%28crittografia%29_-_Museo_scienza_e_tecnologia_Milano.jpg) | The full Enigma machine, showing the rotors, reflector, and plugboard. |
| ๐ **Rotors** | ![Rotors](https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Enigma_rotors_with_alphabet_rings.jpg/220px-Enigma_rotors_with_alphabet_rings.jpg) | The rotating disks (rotors) that scramble the input letters. |
| ๐ **Plugboard (Steckerbrett)** | ![Plugboard](https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/Enigma-plugboard.jpg/220px-Enigma-plugboard.jpg) | The plugboard used for additional letter pair substitutions. |
| ๐ **Reflector (Umkehrwalze)** | ![Reflector](https://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Enigma_insides.agr.jpg/220px-Enigma_insides.agr.jpg) | The reflector that sends the electrical signal back through the rotors. |