The crypto-enigma package

[Tags:bsd3, library, test]

The crypto-enigma package is an Enigma machine simulator with rich display and machine state details.

Currently support is only provided for the machine models in most widespread general use during the war years: the I, M3, and M4.

For basic functionality, including some introspection of machine state and the mappings performed, simply

 > import Crypto.Enigma

For richer display functionality additionally

 > import Crypto.Enigma.Display

(Note that this package assumes support for combining Unicode, without which some output may appear garbled.)


[Skip to Readme]

Properties

Versions 0.0.1.3, 0.0.1.4, 0.0.1.5, 0.0.1.6, 0.0.1.7, 0.0.2.0, 0.0.2.1, 0.0.2.2, 0.0.2.3, 0.0.2.4, 0.0.2.5, 0.0.2.6, 0.0.2.7, 0.0.2.8 (info)
Change log CHANGELOG.md
Dependencies base (>=4.8.1.0 && <=4.9.1.0), containers (>=0.5.5.1), MissingH (>=1.3.0.1), mtl (>=2.2), split (>=0.2.2) [details]
License BSD3
Copyright (c) 2014-2016 Roy Levien
Author Roy Levien
Maintainer royl@aldaron.com
Category Cryptography, Education
Home page https://github.com/orome/crypto-enigma-hs
Bug tracker https://github.com/orome/crypto-enigma-hs/issues
Source repository head: git clone git://github.com/orome/crypto-enigma-hs.git -b develop
this: git clone git://github.com/orome/crypto-enigma-hs.git -b hackage(tag 0.0.2.8)
Uploaded Wed Dec 28 20:59:45 UTC 2016 by Orome
Updated Wed Dec 28 21:13:30 UTC 2016 by Orome to revision 1
Distributions LTSHaskell:0.0.2.8, NixOS:0.0.2.8, Stackage:0.0.2.8, Tumbleweed:0.0.2.8
Downloads 960 total (22 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2016-12-28 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for crypto-enigma

Readme for crypto-enigma-0.0.2.8

crypto-enigma

Haskell Programming Language Hackage Hackage Dependencies BSD3 License Build Status

An Enigma machine simulator with state and encoding display.

Currently support is only provided for those machine models in most widespread general use during the war years: the I, M3, and M4.

This is adapted, as an exercise in learning Haskell, from an earlier learning project written in Mathematica. It is my first Haskell program. A Python version with substantially the same API, plus a command line interface, is also available.

Functionality

Perform message encoding:

>>> enigmaEncoding (configEnigma "b-γ-V-VIII-II" "LFAP" "UX.MO.KZ.AY.EF.PL" "03.17.04.11") "KRIEG"
"GOWNW"

>>> let cfg = configEnigma "c-β-V-VI-VIII" "CDTJ" "AE.BF.CM.DQ.HU.JN.LX.PR.SZ.VW" "05.16.05.12"
>>> putStr $ showEnigmaEncoding cfg "FOLGENDES IST SOFORT BEKANNTZUGEBEN"
RBBF PMHP HGCZ XTDY GAHG UFXG EWKB LKGJ

Show configuration details:

>>> let cfg = configEnigma "b-γ-V-VIII-II" "LFAP" "UX.MO.KZ.AY.EF.PL" "03.17.04.11"
>>> putStr $ showEnigmaConfigInternal cfg 'K'
K > ABCDEFGHIJK̲̅LMNOPQRSTUVWXYZ
  P YBCDFEGHIJZ̲̅PONMLQRSTXVWUAK         UX.MO.KZ.AY.EF.PL
  1 LORVFBQNGWKATHJSZPIYUDXEMC̲̅  Q  07  II
  2 BJY̲̅INTKWOARFEMVSGCUDPHZQLX  A  24  VIII
  3 ILHXUBZQPNVGKMCRTEJFADOYS̲̅W  F  16  V
  4 YDSKZPTNCHGQOMXAUWJ̲̅FBRELVI  L  10  γ
  R ENKQAUYWJI̲̅COPBLMDXZVFTHRGS         b
  4 PUIBWTKJZ̲̅SDXNHMFLVCGQYROAE         γ
  3 UFOVRTLCASMBNJWIHPYQEKZDXG̲̅         V
  2 JARTMLQ̲̅VDBGYNEIUXKPFSOHZCW         VIII
  1 LFZVXEINSOKAYHBRG̲̅CPMUDJWTQ         II
  P YBCDFEG̲̅HIJZPONMLQRSTXVWUAK         UX.MO.KZ.AY.EF.PL
G < CMAWFEKLNVG̲̅HBIUYTXZQOJDRPS

Simulate machine operation:

>>> let cfg = configEnigma "b-γ-V-VIII-II" "LFAP" "UX.MO.KZ.AY.EF.PL" "03.17.04.11"
>>> putStr $ showEnigmaOperation cfg "KRIEG"
    OHNKJYSBTEDMLCARWPGIXZQUFV  LFAP  10 16 24 06
K > CMAWFEKLNVG̲̅HBIUYTXZQOJDRPS  LFAQ  10 16 24 07
R > HXETCUMASQNZGKRYJO̲̅IDFWVBPL  LFAR  10 16 24 08
I > FGRJUABYW̲̅DZSXVQTOCLPENIMHK  LFAS  10 16 24 09
E > SJWYN̲̅UZPQBVXRETHIMAOFKCLDG  LFAT  10 16 24 10
G > EOKPAQW̲̅JLHCISTBDFVMNXRGUZY  LFAU  10 16 24 11

Limitations

Note that the correct display of some characters used to represent components (thin Naval rotors) assumes support for Unicode, while some aspects of the display of machine state depend on support for combining Unicode. This is a known limitation that will be addressed in a future release.

Documentation

Full documentation — for the latest release version — is available on Hackage.

Alternatives

For other Haskell Enigma machines see:

This package served as the basis for a Python version, with essentially the same API.

Development status

Build Status

I'm currently learning and experimenting with some Haskell language features and can't promise the development version will work. More detail about planned releases and activities can be found the list of scheduled milestones and in the list of open issues.