Skip to content

rjhacks/enigma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Enigma

A golang implementation of a German Wehrmacht (Army) Enigma I, which was used to encrypt German radio messages during World War 2.

The Enigma encryption was cracked by a team of Allied cryptographers at Bletchly Park, notably including Alan Turing. The machines they built to break Enigma arguably kick-started the field of computer science.

Installation

go install github.com/rjhacks/enigma

Usage

Command-line interface

gif

Or decrypt a real-life message from the Enigma I manual!

$GOPATH/bin/enigma crypt  \
  --reflector=A  \
  --rotors=II,I,III \
  --ringSettings=24,13,22 \
  --plugPairs=AM,FI,NV,PS,TU,WZ \
  --positions=A,B,L \
  GCDSE AHUGW TQGRK VLFGX UCALX VYMIG MMNMF DXTGN VHVRM MEVOU YFZSL RHDRR XFJWC FHUHM UNZEF RDISI KBGPM YVXUZ

As a library

If you'd like to play with the Enigma in code, you can include it directly in your programs. See enigma/enigma_test.go for examples.

Model details

This implementation of the Enigma aims to be true to the Enigma I, as it was in December 1938. The defining characteristics of this model include:

  • Three rotors (although the core code actually supports any number of rotors), chosen from a set of five rotors, I through V.
  • A single turnover point per rotor.
  • A straight connection on the entry stator (AKA: entry wheel, Eintrittswalze, ETW). Straight means that A maps to A, B maps to B, and so forth.
  • No "Uhr", a possible extension of the plugboard.

References

There is a wealth of information about the Enigma on the internet, thanks to its historic status. Some pages that were particularly helpful in building the understanding of Engima for this implementation were:

Despite these excellent sources, there is conflicting information about whether the rotors rotate before or after the electrical contact for a letter is made. Based on example encryptions, the correct answer here is that the rotors rotate before the contact is made.

About

A `golang` implementation of a German Wehrmacht (Army) Enigma I

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages