Skip to content

azulejo49/EnigmaSFML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enigma Machine Simulator (SFML/mingw64)

Author: Amiram Azulay

A realistic Enigma machine simulator implemented in C++ using **SFMLmingw64.
This project visually replicates the World War II German Enigma cipher machine with:

  • Rotors that step with each key press
  • Two-row lampboard that lights up encrypted letters
  • On-screen clickable keyboard (QWERTY)
  • Input/output panel with properly aligned text
  • Plugboard settings for letter swapping
  • Fully SFML-based GUI with shapes and text

Features

  • Rotor Simulation: Three rotors with accurate stepping logic and notch mechanism.
  • Plugboard: Swap letters like the historical Enigma.
  • Lampboard: Two rows of 26 lamps that glow when letters are encrypted.
  • On-screen Keyboard: Clickable letters, also responds to physical keyboard.
  • Input/Output Panel: Shows typed and encrypted letters.
  • Realistic UI: rotor display, lampboard, and keyboard using SFML shapes and text.

Requirements

  • C++17 or higher
  • SFML 2.5.1+
  • Compatible with Windows, Linux, and macOS

Project Structure

EnigmaSFML/ ├── main.cpp # Main SFML GUI and event loop ├── enigma.hpp # Enigma machine classes and interfaces ├── enigma.cpp # Enigma machine logic (rotors, reflector, plugboard) ├── arial.ttf # Font for rendering text ├── sfml-graphics-2.dll # SFML DLLs (Windows) ├── sfml-window-2.dll ├── sfml-system-2.dll ├── README.md


Installation & Compilation (Windows)

1.Install SFML Download SFML 2.5.1 from https://www.sfml-dev.org/download.php and extract it, e.g., C:/SFML-2.5.1.

2.Download the repository

EnigmaSFML

3.Compile with g++

g++ main.cpp enigma.cpp -o EnigmaSFML
-IC:/SFML-2.5.1/include
-LC:/SFML-2.5.1/lib
-lsfml-graphics -lsfml-window -lsfml-system

4.Copy SFML DLLs to the executable folder:

sfml-graphics-2.dll

sfml-window-2.dll

sfml-system-2.dll

5.Run the program

EnigmaSFML.exe

Usage

Typing: Use your keyboard or click the on-screen keys.

Rotors: Step automatically with each key press.

Lampboard: Letters light up for a short duration when encrypted.

Input/Output: Visible at the bottom of the window with proper spacing.

Code Overview

enigma.hpp/cpp – Implements the Enigma machine:

Rotor: Handles rotor wiring, stepping, and notch positions

Reflector: Reflects letters for encryption

Plugboard: Swaps letters according to user-defined wiring

EnigmaMachine: Combines rotors, reflector, and plugboard, handles encryption logic

main.cpp – Handles SFML GUI:

Displays rotors, lampboard, keyboard, input/output text

Handles keyboard and mouse events

Animates rotor positions and lampboard glow

License / Authorship

This project is authored and maintained by Amiram Azulay.

visual preview of the Enigma layout ASCII/boxes

┌─────┐ ┌─────┐ ┌─────┐ │ A │ │ A │ │ A │ <-- Rotor letters (top/mid/bottom) │ B │ │ B │ │ B │ │ C │ │ C │ │ C │ └─────┘ └─────┘ └─────┘

Lampboard (two rows): ┌───┬───┬───┬───┬ ... ┐ │ A │ B │ C │ D │ ... │ └───┴───┴───┴───┴ ... ┘ ┌───┬───┬───┬───┬ ... ┐ │ N │ O │ P │ Q │ ... │ └───┴───┴───┴───┴ ... ┘

Keyboard (clickable): ┌───┬───┬───┬───┬ ... ┐ │ Q │ W │ E │ R │ ... │ └───┴───┴───┴───┴ ... ┘ ┌───┬───┬───┬───┬ ... ┐ │ A │ S │ D │ F │ ... │ └───┴───┴───┴───┴ ... ┘ ┌───┬───┬───┬───┬ ... ┐ │ Z │ X │ C │ V │ ... │ └───┴───┴───┴───┴ ... ┘

Input / Output Panel at bottom: Input: HELLO Output: RFKTJ

About

Realistic Enigma Machine Simulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages