/enigma-haskell

An implementation of the enigma machine in haskell

Primary LanguageHaskellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

enigma-haskell

A haskell implementation of the Enigma machine

Written mainly to try out the freer-simple effects library

Process overview

Process overview

  1. A button is pressed

  2. The machine steps (rotates) the rotors

    2.1 - Rotor I (right, fast) is stepped unconditionally

    2.2 - Rotor II (middle) is stepped only if Rotor I or itself is currently in a turnover position.

    • Stepping both Rotor II and Rotor III whenever Rotor II is in a turnover position is called a 'double step'. It is a solution to a mechanical limitation specific to the M3 model. If Rotor II remained in turnover position until the next time Rotor I reached a turnover position, Rotor III would also be stepped on every iteration until that point (which would reduce the total number of unique states). More information here.

    2.3 - Rotor III (left, slow) is stepped only if Rotor II is currently in a turnover position

  3. The current passes through the components

    3.1 - Plugboard (forward)

    3.2 - Rotor I (forward)

    3.3 - Rotor II (forward)

    3.4 - Rotor III (forward)

    3.5 - Reflector

    3.6 - Rotor III (backward)

    3.7 - Rotor II (backward)

    3.8 - Rotor I (backward)

    3.9 - Plugboard (backward)

  4. A lightbulb signifying the output character lights up

    • the output character is always different from the input character