Recovery of Rotors II, III and IV


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

Introduction

As soon as Friedman recovered the wiring of the rotor in Position V, he could (admittedly, with great difficulty) reconstruct the plain text of the 10 messages. Then, from the moment the wiring of the rotor I was known, finding the plain text of the messages became simple. He had won the Navy challenge.

So why did he decide to go further and in particular to recover the wiring of rotors II, III and IV? Especially if we consider that in a real context, the enemy just needs to wait until each rotor is in position V (or I), to easily find its wiring.

I think Friedman wanted to "amaze" the Navy cryptologists and in particular to ridicule Agnes Driscoll who had supported Mr. Hebern's project. Although W. F. Friedman was a great cryptologist, he was nonetheless a man with an oversized ego (like many geniuses).

Friedman also reasoned as a cryptologist: If we know how the Hebern machine works as well as the wiring of the rotors and finally the external key deduced from the indicator, it is possible to decipher any message as easily as if we were the official recipient of the message.

Request for additional information from the Navy

After recovering the plain text of the messages thanks to its knowledge of the wiring of rotors I and V, Friedman thought of recovering the wiring of the remaining rotors (II, III and IV).

Unfortunately, he quickly realized that he needed to know the complete external key, in short the initial position, for each message from rotors II and IV.

Because Friedman had already won the challenge, the Navy did not hesitate to give him this information. So here is the External key for all messages:

        1:      A G R R A A M
        2:      C O B B A A N
        3:      B L O O I I S
        4:      A G A A N N A
        5:      C U N N E E O
        6:      D O V V E E R
        7:      G E N N O O A
        8:      H A G G U U E
        9:      M O N N T T E
        10:     N E P P A A L

Friedman hypothesis on the meaning of indicators

From the beginning, Friedman knew that the indicator of each message contained the position of the rotors except those of rotors II and IV. Perhaps the Navy had entrusted him with this information or he had deduced it on his own.

But why not indicate the position of rotors II and IV? Friedman made the hypothesis that in the daily key there was not only the order of the rotors used but also the position of rotors II and IV for each station in order to avoid that, by chance, two (or three) messages could use the same external key and can be put "in-depth".

Friedman thought this practice was silly for two reasons:

  • The probability of having two identical external keys is very low.
  • Having two or three "in-depth" messages is not sufficient (for a rotor machine) to find the plain text of the messages. In fact it takes (according to Friedman) more than 50 messages to hope to get there.

Friedman's reasoning (verbatim)

Here is Friedman's reasoning (verbatim):
Note: Friedman uses the term CW2 to specify the rotor in position II.

"67. Study of keys .-This list was then carefully examined to find two messages which meet the following requirement, viz, that as regards CW2, 3, and 4 there should be a case in which the two dispatches should have the same pair of key letters indicating the initial setting for CW2 and 3, or for CW3 and 4. The purpose in finding such messages is, naturally, to be able to compare the cipher resultant of two specific cases wherein the differences in the cipher resultants for the same plain-text lettter will be due solely to the displacement of a single cipher wheel. Three dispatches were found to conform to this requirement, viz, nos. 5, 7, and 9. In these three messages CW2 was initially set at N, and likewise CW3, although of course the similarity between the setting letter on CW2 and 3 was only a condition arbitrarily brought about by the system adopted by the Code and Signal Section, and is not a necessary condition to be met. The setting of CW2 and 3 in each dispatch can be different; it is only that for the purposes of this reconstruction the pair of settings for CW2 and 3 for one dispatch coincide with that for CW2 and 3 for another dispatch. Considering only nos. 5 and 7, it will be seen that whatever difference there be in the cipher resultants for the same plain-text letter enciphered in the same position as regards CWl, 2, 3, and 5, will be due solely in the difference in the position of CW4. In no. 5, CW4 is set at E, in no. 7, at O."

The detail of the covering of rotors II, III and IV by Friedman

Here is the wiring of rotors II, III and IV according to Friedman:

	CW2: ORLWVJFPXMHYGTKNCZSUEADIQB
	CW3: TSKPLDRBEIZGJOCFWNVXUAYHQM
	CW4: YERTIQFNJOHVAWBLKDSXMCPZGU
We refer the reader to Friedman's report for the details of his reasoning.

Unfortunately these wirings do not allow the messages of the Navy challenge to be deciphered.

My reconstruction of the wiring of rotors II, III and IV

Introduction

I was very frustrated that I couldn't decipher the challenge messages using Friedman's solution of the rotors wiring II, III and IV. I then decided to rebuild these wirings myself.

I take Friedman's reasoning and try to find the wiring of rotor IV from messages 5 and 7. In these two messages, the indicators are CUNNEEO and GENNOOA respectively. Thus, the position of rotors II and III are identical in the two messages (NN). These two rotors can thus be considered as a single immobile rotor. Rotor IV has position E in message 5 and has position O in message 7. We can also use the start of message 9 for which rotor IV has position T.

Then, we can study message 7. Indeed, in the middle of the message, rotor III advances. We therefore have (after removing the action of rotor IV), the key NN at the start of the message for rotors II and III. Then, for the second part of message 7, we have the key NO. We deduce the wiring of rotor III and finally the wiring of rotor II.

In both cases (reconstruction of rotor IV and rotor III), the same method is used: using the established formulas to find the rotor wiring of a Hebern 1 rotor machine (plain known, using formula).

1st step: find the stator S equivalent to rotors II, III and IV

For messages 5 and 7, we will search for the stator S equivalent to rotors II, III and IV. We also look for the equivalent of rotors II, III and IV for message 7 after the advancement of rotor III (we go from NNO to NOO).

We use the method explained on the page Permutation S.

  Message 5, indicator CUNEO, stator 234: ENTHWDYUKIFZRALCOGXPSJBVQM
  Message 7, indicator GENOA, stator 234: ZREOPIVTFDJSQMUGNXHBYCAKWL
  Message 7, key NLNNOCO, stator:         FYKEQSRMLOCPAJVHGZNWIDUBTX
Here are the decryptions using these reconstructed stators:
C:\H5_TOOLS> type ROTORS\CUNEO_234.rot
ENTHWDYUKIFZRALCOGXPSJBVQM

C:\H5_TOOLS> python hebern5_tui.py -I N1:0:CUNEO_234:0:N5 -E CUAAAEO 
	-d < CHAL1924\msg_05.cry
SMITHSTATESCASESCONTAININGCONTRABANDWEREPOINTEXGPRAEGXSBYMAJORRSSNIVELY
WHOSTATEDTHATTHEYCONTAINEDHOUSEHOLDGOODSOFHISSTOPHEREQUESTEDSMITHTOLOOK
OUTFORTHEMSTOPSMITHSAIDHESAWSIMILARBOXESINCOURSEOFCONSTRUCTPRNINBACKYAR
DOFSNIVELYSQUARTERSANDSAWASIMILARBOXWITHONECORNEROPENATPOLICIABARRACKSI
NTDXMIRTDSHSJRKAXCSVNJNMSYNEPTDHUZGUXDHUZG

C:\H5_TOOLS> type ROTORS\GENOA_234.rot		
ZREOPIVTFDJSQMUGNXHBYCAKWL

C:\H5_TOOLS> python hebern5_tui.py -I N1:0:GENOA_234:0:N5 -E GEAAAOA 
	-d < CHAL1924\msg_07.cry
GERMANCONTRACTSFORYEARCONTEMPLATESFORCUTTINGUPBRITISHWARSHIPSASFOLLOWSA
PPROXIMATELYFORTYTHODICFJEAMMFSQMRSAZDYAWGRHNCLUDINGEIGHTSUPPOSEDFOURLA
RGECRUISERSTHREESMALLCRUISERBAVHUWRRMZMWUVLHFRLEMLWNUAAEOSNWOPTTWOQWGAT
AFATTAMTMGIOUOOYLNZAMGTOFWNVZCKMVGOSLKDPOPPOPLDZRMDTMCFYJKXEZMZCKFEZZLT
MVGBMKYIEHZKHSLNRREGJPYNRHXZFJRPJNEEVWS

C:\H5_TOOLS> type CHAL1924\msg_07_p2.cry
D K L W H H P V W A U T U N K A E I S J T B Z P
I L L V M K Q B O Y X J M H U K F H B G X S A H Z O
O I Q N M G M O G Y B W U H Y F K O T S P L I B O F
E W K D Y A D X Z S N X L J Q W O S K U R L E O G L
S V Z W W G O Y Q C W J S A D P S O Q U Y H D S U R
S E N X T M F T Q Y L O S W U M J L P V A Q K T

C:\H5_TOOLS> type ROTORS\OLODP_234.rot
FYKEQSRMLOCPAJVHGZNWIDUBTX

C:\H5_TOOLS> python hebern5_tui.py -I N1:0:OLODP_234:0:N5 -E OLAAADP 
	-d  <  CHAL1924\msg_07_p2.cry
FOURTEENINTRODUCEDANDTHREEMONITORSSTOPTHESEVESSELSHAVEBEENPURCHASEDOUTR
IGHTACPBLTZCZZCZBTXUDTKDVAQELORTSTWOBATTLESHIPSOFDANTONCLASSPURCHASEDFO
RSCRAPPING

2nd step: Find rotor IV wiring


	y = L[ R[ x + i ] - i ]

The basic formula used here gives the ciphered letter (y) from the plain letter (x) undergoing the permutation of a rotor (R) and the Lampboard permutation (L).

In our case, permutation L corresponds to pseudo stator II+III at position NN. The permutation R corresponds to the inverse rotor IV at position E and O. For E, i corresponds to key A (zero or 0) and for O, the key corresponds to the key K (O-E=10). The value x corresponds to the decipherment of a letter of the cryptogram after elimination of the RFS permutation and that of the rotor V (so, x corresponds to c’). The value y corresponds to the result of the encryption of a clear letter after the LFS permutation and the rotor I.

  Ciphered letter y   : abcdefghijklmnopqrstuvwxyz
  Plain letter x(0)   : ENTHWDYUKIFZRALCOGXPSJBVQM
  Plain letter x(10)  : ZREOPIVTFDJSQMUGNXHBYCAKWL

If y(0) = y(10) Then L[ R[x(0)] ] = L[ R[x(10)+10]-10 ]
Conclusion:
	R[x(0)] = R[x(10)+10]-10

y = A, x(0) = E and x(10) = Z, then R[E]=R[Z+10]-10 = R[J]-10
y = B, x(0) = N and x(10) = R, then R[N]=R[R+10]-10 = R[B]-10
y = C, x(0) = T ans x(10) = E, then R[T]=R[E+10]-10 = R[O]-10
etc...
We set R[A]=0 arbitrarily. Unfortunately, only two sets of 13 independent relationships can be deduced. Thanks to message 9 we obtain some additional relationships and we can deduce the wiring of the rotor IV inverse to the relative key A:
      Rotor IV reverse (relative key A): AHETVCYINFRLPXWBOQDMJZKGSU
Then, we easily deduce the wiring of the rotor IV to the relative key A and finally the wiring of the rotor to the absolute key (shifted by five negative positions):
      Rotor IV at the relative key A: APFSCJXBHUWLTIQMRKYDZEONGV	
      Rotor IV at the absolute key A: SRKZETJWGNBFLYAPXMUQVOCHDI
      Rotor IV reverse              : OKWYELIXZGCMRJVPTBAFSUHQND

3rd step: Find the stator wiring II+III

Now we must eliminate the action of rotor IV to obtain different configurations of stators II+III.

	Stator 2+3 for NN key:  VXMIKTSJRNCUQALEWYGBDFHZOP
	Stator 2+3 for NO key:  RDZMQUXAPIFKHCSGEVWOTNLBJY

H1_TOOLS> echo ABCDEFGHIJKLMNOPQRSTUVWXYZ | python3 hebern1_tui.py ^
     -K CUNEO_234 -R =OKWYELIXZGCMRJVPTBAFSUHQND -E E -m
VXMIKTSJRNCUQALEWYGBDFHZOP

H1_TOOLS> echo ABCDEFGHIJKLMNOPQRSTUVWXYZ | python3 hebern1_tui.py ^
	-K OLODP_234 -R =OKWYELIXZGCMRJVPTBAFSUHQND -E O -m
RDZMQUXAPIFKHCSGEVWOTNLBJY

4th step: find the wiring of the rotor III

  Ciphered letter y   : abcdefghijklmnopqrstuvwxyz
  Plain letter x(0)   : VXMIKTSJRNCUQALEWYGBDFHZOP
  Plain letter x(1)   : RDZMQUXAPIFKHCSGEVWOTNLBJY

y = A, x(0) = V and x(1) = R, then R[V]=R[R+1]-1 = R[S]-1
y = B, x(0) = X and x(1) = D, then R[X]=R[D+1]-1 = R[E]-1
y = C, x(0) = M and x(1) = Z, then R[M]=R[Z+1]-1 = R[A]-1
etc...
We set R[A]=0 arbitrarily. Then, we can deduce the wiring of the rotor III inverse at the relative key A:
	Rotor III inverse: ARUBXJVYOQLDZPKSNMGECFIWHT
	Rotor III        : ADULTVSYWFOKRQINJBPZCGXEHM
	Rotor III (absolute key A):  DVAWOCMPTKRUZNQHYGIFLJSBXE 
        Rotor III inverse (absolute):CXFAZTRPSVJUGNEHOKWILBDYQM

5th step: find the wiring of the rotor II

By eliminating the permutation of the rotor III we obtain the wiring of rotor II.

   Rotor II (at the relative key A): FWZOLEGQMPUCNADXIHVRBJYTKS	
   Rotor II (at the absolute key A): NQKVUIEOWLGXFSJMBYRTDZCHPA
Demonstration:
C:\H1_TOOLS> echo ABCDEFGHIJKLMNOPQRSTUVWXYZ | python hebern1_tui.py ^
	-K =VXMIKTSJRNCUQALEWYGBDFHZOP  ^
	-R =CXFAZTRPSVJUGNEHOKWILBDYQM -E N -m
FWZOLEGQMPUCNADXIHVRBJYTKS

C:\H1_TOOLS> echo ABCDEFGHIJKLMNOPQRSTUVWXYZ | python hebern1_tui.py ^
	-K =RDZMQUXAPIFKHCSGEVWOTNLBJY  ^
	-R =CXFAZTRPSVJUGNEHOKWILBDYQM -E O -m
FWZOLEGQMPUCNADXIHVRBJYTKS

Web Links

  • ANALYSIS OF A MECHANICO-ELECTRICAL CRYPTOGRAPH, PART I, TECHNICAL PAPER, BY WILLIAM F. FRIEDMAN Cryptanalyst, Chief of Signal Intelligence Section UNITED STATES GOVERNMENT PRINTING OFFICE, WASHINGTON: 1934, Secret.
    Section XIII, p83, Reconstruction of other alphabets. (link)