Hebern 1 rotor cipher machine simulator


Home Page
Hebern's machines Home Page

Introduction

This web page presents my simulation program for the Hebern 1 rotor cipher machine. This program is written in Python and works in text mode. The Python interpreter must be installed.

Download, install

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/h1/H1_TOOLS.tar.gz
  3. Unzip:
    C:\> tar xf H1_TOOLS.tar.gz
  4. Position yourself in the created directory:
    C:\> cd H1_TOOLS
  5. Test the software startup (its syntax is displayed):
C:\H1_TOOLS> python hebern_tui.py -h
usage:
Syntax : hebern1_tui.py [options...]
Example: echo AAAAA | python hebern1_tui.py -R c1
Options:
  -L lamp     The lampboard permutation (iden by defaults)
  -K keyb     The keyboard permutation (iden by defaults)
  -R rotor    The rotor (iden  by defaults)
  -E external The external key (Z by default)
  -d          Decipher Mode (cipher mode by default)
  -t          Trigonometric direction (False [clockwise] by default)
  -T          The Rim is different from direction (False by default)
  -m          Dont Move (0 by default)
  -r          Reverse the Rotor (mirror)
  -D          Debug Mode
Note: for L,K,R options, if you begins with =, the wiring is
given, otherwise, you must give a file which contains the wiring
the filename is given without the .rot extension and it must
be in the ROTORS/ directory.
Note: iden = identity permutation = ABC...Z
Note: You can download my Hebern 1-rotor tools which includes my simulator. Here is the download link: (link)

Simple use

  1. We create a text file
    Note: we recommend storing the files (plain and encrypted texts) in the MSGS directory.

    WARNING! The first command (echo …) deletes the file if it exists.

    C:\H1_TOOLS> echo Hello World   > MSGS\small_text.txt
    C:\H1_TOOLS> type MSGS\small_text.txt
    
    Notes:
    • If you want to modify the file (to make it longer, for example):
      C:\H1_TOOLS> notepad  MSGS\small_text.txt
      
    • In the MSGS directory there are already plain text files. They have the extension *.txt or *.pln, for example, MSGS\small_text.pln.
  2. We encrypt it.

    a) You can encrypt a text directly (without going through a file) and display the cryptogram on the screen (without saving it).

         
    C:\H1_TOOLS> echo Hello World |python hebern1_tui.py -R =FQTGXANWCJOIVZPHYBDRKUSLEM
    WZXMZLEXJM
    
    b) Via Shell redirections (Windows CMD or Linux bash), we can redirect IO.
    Note: The following command is on a single line.
    C:\H1_TOOLS> python hebern1_tui.py -R =FQTGXANWCJOIVZPHYBDRKUSLEM < MSGS\small_text.txt ^
     | python groupe.py > MSGS\small.cry
    
  3. We display the cryptogram (it is in the form of groups of 5 letters).
       C:\H1_TOOLS> type MSGS\small.cry
       WZXMZ LEXJM
    
  4. Decrypting a file
        C:\H1_TOOLS> python hebern1_tui.py -R  =FQTGXANWCJOIVZPHYBDRKUSLEM -d  ^
            < MSGS\small.cry
        HELLOWORLD
    

Using the different options

Permutations

The permutations (Lampboard, Keyboard and Rotor) can be given directly as arguments, as in the previous examples or provided as files. We just indicate the name of the rotor. The corresponding file is searched in the ROTORS directory with the extension “.rot”. So rotor “c5” corresponds to the file ROTORS\c5.rot.

- The fifth rotor of the Hebern 5 rotor machine.

    C:\H1_TOOLS> type ROTORS\c5.rot
    FQTGXANWCJOIVZPHYBDRKUSLEM
- The wiring of RFS (lampboard of the Hebern 5 rotors machine).
     C:\>H1_TOOLS> type ROTORS\RFS.rot
     TYOEUMXDFJQVKWBNSHCILRZAGP
- The wiring of LFS (Keyboard of the Hebern 5 rotors machine).
      C:\H1_TOOLS> type ROTORS\LFS.rot
      XAKHSZJLYWGPMIOURDBFTNVCQE
- Ciphering with (and without) Lampboard and Keyboard permutations.
     C:\H1_TOOLS> echo Hello World | python  hebern1_tui.py -R c5
     WZXMZLEXJM

     C:\H1_TOOLS> echo Hello World | python hebern1_tui.py -R c5 -K LFS -L RFS
     FSPTPTUDEN

The message key

The message key of a cryptogram created by a Hebern 1 rotor machine must specify:

  • The rotor number (if there are several rotors).
  • Whether it is positioned right side up or upside down.
  • And finally, the initial position of the rotor.
WARNING! In most mechanical encryption machines, the rotor advances before encryption. This is indeed the case with the Hebern 1 rotor machine. So, if the external key is "H", the effective key H+1 = I. By default, the external key is "Z" (and therefore the effective key is "A").
   C:\H1_TOOLS> echo Hello World | python hebern1_tui.py -R c5 -r -E H
   TOCHSBBOSC
Note: In the example, the external key (the initial position of the rotor) is “H” and the c5 rotor is reversed.

The basic key

Depending on the machine design, some elements are not configurable, such as the Lampboard and Keyboard swaps. It is the same for the advancement of the rotors which is done either clockwise or in the opposite direction (trigonometric direction).

In a computer program, it is easy to change these settings. By default, the rotor advances clockwise. With the “-t” option, it advances in the trigonometric direction.

    C:\H1_TOOLS> echo Hello World | python hebern1_tui.py -R c5 -t
    WHLFSGIVOT

Debug

The “-D” option displays the details of the permutations. The “-m” option blocks rotor advancement.

C:\H1_TOOLS> echo Hello World | python hebern1_tui.py -R c5 -D -L RFS
Key: Z
...
Direction: Clockwise
Rotor Reverse: False
Edge : ABCDEFGHIJKLMNOPQRSTUVWXYZ

----  (K) :P K R L  (Key), Plain, Keyboard, Rotor, Lampboard [cipher]
0001: (Z) :H H W Z
0002: (A) :E E Z P
0003: (B) :L L X A
0004: (C) :L L M K
0005: (D) :O O Z P
0006: (E) :W W L V
0007: (F) :O O E U
0008: (G) :R R X A
0009: (H) :L L J J
0010: (I) :D D M K
ZPAKPVUAJK

Emulate a 5-rotors machine

My simulator for the 1-rotor Hebern can emulate the operation of a 5-rotor Hebern machine in the case where only the right rotor (the fast rotor) moves forward. Here is an example :

H1_TOOLS> echo HELLOWORLD | python hebern1_tui.py -K LFS -L RFS -R 5
FSPTPTUDEN

H5_TOOLS> echo HELLOWORLD | python hebern5_tui.py -I 0:0:0:0:5 -E AAAAAZZ
FSPTPTUDEN

Hebern 1 rotor Simulator written in Excel

Rafael Pascual has created an Excel worksheet that simulates the Hebern one rotor machine. This one is available on this site with his permission.

Hebern 1 rotor simulator in Excel