Skip to content

zlxlty/Enigma_Machine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enigma

This is a simulator of Enigma Machine --- a classic mechanical cipher used in WW2.


Content


Getting_Started

Prerequisites

  • For linux and Mac
  • gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)
  • GUN Make 4.1

Installing

Clone this repo by using

$ git clone https://github.com/zlxlty/Enigma_Machine.git

Compiling

Enter the src folder and type in

$ make

Delete all the object files by using

$ make clean_objs

Run_Enigma

Basic Function

To use the encryption function in Enigma simulator, you just have to compile first and use terminal and type in:

$ make run_fe

To use the decryption function, type in

$ make run_fd

Type in - to end the program

Customize Key

Use

$ make run_e

to encrypt with your own key. Similarly, use

$ make run_d

for decryption

As most of other ciphers, Enigma requires key to encrypt and and decrypt messages
I am simulating an early version of Enigma which has three keys:

  • The Sequence of Rotors: A three-digit number made up of 1 2 3
  • The initial position of each Rotor: Three English letters
  • The settings of Plugboard: Six pairs of letters

There is no need for you to know all the theories and processes behind the mechanism of Enigma Machine. If you are interested, you can go to this website for more information


Feature

Unit Test

#define _LINKED_DEBUG_ 0
#define _ROTORS_DEBUG_ 0
#define _GROUP_DEBUG_  0
#define _INPUT_DEBUG_  0
#define _MAIN_DEBUG_   0
#define _MAIN_         1

Each source file has a unit test controlled by macro in settings.h. To activate a unit test, just change the corresponding macro to 1.


Rotorsettings

The configuration of the rotors are as follow:

#define _plugboard "AHLOCJKXWERO"
#define _rotor1    "AJDKSIRUXBLHWTMCQGZNPYFVOE"
#define _rotor2    "EKMFLGDQVZNTOWYHXUSPAIBRCJ"
#define _rotor3    "BDFHJLCPRTXVZNYEIWGAKMUSQO"
#define _rotor4    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define _reflector "YRUHQSLDPXNGOKMIEBFZCWVJAT"
#define _alphabet  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Author Tianyi Lu
E-mail lus2@carleton.edu

About

A simulator of the Enigma Machine used during WW2

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages