Find the rotor which is in position V


Home Page
Hebern's machines
The 5 rotors machine home page

Introduction

If we know the wiring of the rotors, it is possible to find the right rotor (the fast Rotor or Rotor in position V).

When the rotor wirings are known, even a single message of several hundred characters can be solved fairly easily.

Making use of Index of coincidence (IC) statistic, we can determine both the identity and starting position of the fast rotor and position of the right ratchet wheel.

To determine the identify and starting position of the fast rotor, V, we test the rotors one by one.

The procedure

  • 1. Remove the influence of Lampboard permutation.
  • 2. Cut the cryptogram into sections of 26 letters.
  • 3. For each slice, calculate the IC and the final mean IC. The good rotor corresponds to the highest IC value.
  • 4. For the rotor considered, we calculate the IC for each position of the rotor.
  • 5. We search for the right ratchet wheel position.

An example

Remove influence from Lampboard permutation

We start by removing the influence of the RFS wiring which corresponds at the first permutation carried out in decryption mode. Then, we cut the cryptogram into slices of 26 characters. For each slice, we calculate the IC and take the average. If the chosen rotor is the right one, each slice is the result of a simple substitution. The largest IC value gives us the starting position of the rotor in position V. If it is the rotor which has actually been used in position V, this IC value is clearly higher than the maximum value obtained for the other rotors.

For the demonstration, we take the message given as an example from the book of Deavours & Kruh, page 49.

- Cryptogram:

C:\H5_TOOLS> more MSGS\kruh_page_49.cry
GEEDN TKVLM TBTFY CYEDV WYZKQ IEQFO GVVUS OJOXP BUHUF RLDLK
SDLHY BYUVB TTMZX TIQQO FVTVG PKITT EDXZF HNLMG IBFOV DBHVO
PCIRM VRTYI AXOTW OVVVB JCNNT EEBCG JGJUZ DJOWY XXWCQ CKTWL
CJSAY NLGIN WHKCG QSEAF CJAGJ NGWFQ WRITY YMVQZ KFICG EXWKQ
VQAHU HKZBM OAXIY TMKAP CJHWH WGIPM QKVGR GLNPI
- Cryptogram, but without the influence of RFS permutation:
C:\H5_TOOLS> python striplamp.py TYOEUMXDFJQVKWBNSHCILRZAGP ^
  MSGS\kruh_page_49.cry > MSGS\kruh_page_49.stripped

C:\H5_TOOLS> python groupe.py < MSGS/kruh_page_49.stripped
YDDHP AMLUF AOAIB SBDHL NBWMK TDKIC YLLEQ CJCGZ OEREI VUHUM
QHURB OBELO AAFWG ATKKC ILALY ZMTAA DHGWI RPUFY TOICL HORLC
ZSTVF LVABT XGCAN CLLLO JSPPA DDOSY JYJEW HJCNB GGNSK SMANU
SJQXB PUYTP NRMSY KQDXI SJXYJ PYNIK NVTAB BFLKW MITSY DGNMK
LKXRE RMWOF CXGTB AFMXZ SJRNR NYTZF KMLYV YUPZT

Cut the cryptogram into slices of 26 letters...

We cut the cryptogram into slices of 26 letters and for each slice, calculate the IC and the final mean IC.

- Calculate IC for the five rotors.
Note: we start by the first rotor (1)

H5_TOOLS> python search_rotor.py 1 < MSGS/kruh_page_49.stripped
IC max: 0.0471, key: M
H5_TOOLS> python search_rotor.py 1 < MSGS/kruh_page_49.stripped
IC max: 0.0406, key: V
...
In short:

First  rotor         : IC max: 0.0471, key: M
First  rotor (mirror): IC max: 0.0422, key: P
Second rotor         : IC max: 0.0406, key: V
Second rotor (mirror): IC max: 0.0431, key: F
Third  rotor         : IC max: 0.0449, key: R
Third  rotor (mirror): IC max: 0.0397, key: D
Fourth rotor         : IC max: 0.0431, key: Q
Fourth rotor (mirror): IC max: 0.0406, key: O
Fith   rotor         : IC max: 0.0514, key: L
Fith   rotor (mirror): IC max: 0.0418, key: N

We can deduce that it is the 5th rotor which was used in the normal direction.

For the rotor considered, we calculate the IC for each position

It seems that the starting position of the 5th rotor is position L. Let's give the IC values for each position:

C:\H5_TOOLS> python search_rotor.py 5 < MSGS\kruh_page_49.stripped 
...
Starting position  Average IC
   A:              0.0348
   B:              0.0332
   C:              0.0292
   D:              0.0382
   E:              0.0311
   F:              0.0320
   G:              0.0345
   H:              0.0305
   I:              0.0363
   J:              0.0332
   K:              0.0360
   L:              0.0514
   M:              0.0338
   N:              0.0351
   O:              0.0434
   P:              0.0369
   Q:              0.0326
   R:              0.0369
   S:              0.0342
   T:              0.0286
   U:              0.0409
   V:              0.0314
   W:              0.0305
   X:              0.0372
   Y:              0.0332
   Z:              0.0388
...

At the correct starting position of the 5th rotor, the 26 consecutive letters will belong to one or two monoalphabetic distributions. This is why the maximum IC value is important but significantly lower than 0.07.

If we find the initial position of the right ratchet wheel, we will have only slices of 26 letters belonging to a single distribution monoalphabetic. The example below searches for this position.

Note: The following is from the previous program, but at the end.


Starting position       Average IC
      0                 0.0564
      1                 0.0545
      2                 0.0566
      3                 0.0569
      4                 0.0582
      5                 0.0582
      6                 0.0609
      7                 0.0669
      8                 0.0615
      9                 0.0641
     10                 0.0642
     11                 0.0666
     12                 0.0685
     13                 0.0637
     14                 0.0593
     15                 0.0581
     16                 0.0558
     17                 0.0536
     18                 0.0517
     19                 0.0513
     20                 0.0521
     21                 0.0514
     22                 0.0530
     23                 0.0533
     24                 0.0547
     25                 0.0554
---> ic max: 0.0685, start of ratchet wheel: A

Note: thanks to my programs, I obtained the previous results. They are similar to those obtained by Deavours & Kruh but different. On the other hand, the conclusions are the same: use of 5th rotor at L position and Ratchet right wheel at A position.

References

  • Machine Cryptography and Modern Cryptanalysis, by Cipher A. Deavours & Louis Kruh, Artech House Editor, 1985.
  • Analysis of the Hebern Cryptograph Using Isomorphs, by Cipher A. Deavours, Cryptologia, Vo. 1, N°2, April 1977.
  • A Solution of the Hebern Messages, by Carl M. Ellison, Cryptologia, Volume XII, Number 3, July 1988.