Hebern 5 rotors simulator and tools


Home Page
Hebern's machines

Introduction

To study the Hebern 5 rotor cipher machine, I had to first write a simulator for this machine and then cryptanalysis tools. Here is the download link for the simulator and cryptanalysis tools: H5_TOOLS.tar.

To break the Hebern 5 rotor machine, I also used tools that I designed to attack the Hebern 1 rotor machine: H1_TOOLS.tar.

Install tools

Here is the download link: (link)

Suggestion to install the software:

  1. Open a terminal.
  2. Download the software with the curl command:
    C:\> curl -O http://www.jfbouch.fr/crypto/hebern/h5/H5_TOOLS.tar.gz
  3. Unzip:
    C:\> tar xf H5_TOOLS.tar.gz
  4. Position yourself in the created directory:
    C:\> cd H5_TOOLS
  5. Test the software startup (its syntax is displayed):

The Simulator

H5_TOOLS> python hebern5_tui.py -h
usage:
Syntax: hebern5_tui.py [option...]
Example:
 echo AAAA|python hebern5_tui.py -I 3:2:5:1:4 -E MEANING -c
Options:
 -h             Help
 -I internal    Internal Key (1:2:3:4:5) by default)
 -V verse       The Face of each rotor (00000 by default)
 -E external    Extenal Key (NZAZAZN by default
                which corresponds to effective key OAAAAAO)
 -c/-d          Cipher (by default)/Decipher
 -v/-D          Verbose (Debug)


H5_TOOLS> echo ONZOV HLDGN XBVPW YMRN | python hebern5_tui.py ^
  -I 1:2:3:4:5 -E MEANING  -d
AMMUNITIONEXHAUSTED

H5_TOOLS> echo AMMUNITIONEXHAUSTED | python hebern5_tui.py ^
   -I 1:2:3:4:5 -E MEANING -c | python groupe.py
ONZOV HLDGN XBVPW YMRN

H5_TOOLS> echo AAAAAAAAAAAAAAAAAAAAAAAAAA | python ^
    hebern5_tui.py -I 1:2:3:4:5 -E OAAAAZN -c | python groupe.py
YONDS WMAUZ XFLQK GXVHR BTECJ P

H5_TOOLS> echo AAAAAAAAAAAAAAAAAAAAAAAAAA | python hebern5_tui.py ^
    -I 1:2:3:4:5 -E OAAAAZN -c -v |more
Key: NZAZAZN
Mode (0:chiffre,1:dechiffre):0
Key Stator : XAKHSZJLYWGPMIOURDBFTNVCQE
Rotor Rotor 1
- Cle: A
- Verse (0:sens normal,1:inverse):0
- Rotor : GADBOCTKNUZXIWHFQYJVPMELSR
Rotor Rotor 2
- Cle: A
- Verse (0:sens normal,1:inverse):0
- Rotor : IZNCTKUDPJEVOWLFHXSMGQAYBR
Rotor Rotor 3
- Cle: A
- Verse (0:sens normal,1:inverse):0
- Rotor : PJXFWLTAUGYBMHROVNCKSEQIZD
Rotor Rotor 4
- Cle: A
- Verse (0:sens normal,1:inverse):0
- Rotor : FLVARGWCMQBXNYIOTJUPSKEDHZ
Rotor Rotor 5
- Cle: Z
- Verse (0:sens normal,1:inverse):0
- Rotor : FQTGXANWCJOIVZPHYBDRKUSLEM
Lamp Stator : TYOEUMXDFJQVKWBNSHCILRZAGP

Key:  NZAZAZN
001: A ->XLVERB-> Y    OAAAAAO
002: A ->XLVERC-> O    OAAAABP
003: A ->XLVERP-> N    OAAAACQ
004: A ->XLVERH-> D    OAAAADR
005: A ->XLVERQ-> S    OAAAAES
006: A ->XLVERN-> W    OAAAAFT
007: A ->XLVERF-> M    OAAAAGU
...
YONDSWMAUZXFLQKGXVHRBTECJP

H5_TOOLS> echo THEELEMENTSOFTHESCIENCEOFC | python hebern5_tui.py 
IUOJUVJPFPJSCLVIKSDBMZDJSK

Tools

Note: the chapter cryptanalysis gives examples of use of these tools.
  • friedman_h5.py: Friedman's statistical attack (v1).
  • fried_new.py: Friedman's statistical attack (v2).
  • hc_h5.py: Hill Climbing attack of the rotor at the position V.
  • search_rotor.py: Search for the rotor in position V (known wiring).
  • striplamp.py: Remove Lampboard swap.
  • ic.py: calculates the IC (index of coincidence) of a file.
  • groupe.py: Displays a cryptogram per group of 5 letters.