The Friedman method, rotor and lampboard unknown


Home Page
Hebern's machines Home Page
Hebern 1 rotor Home Page
Cryptanalysis, Home Page

Introduction

In the previous chapter, we have used the Friedman interval statistical method v1 when only the rotor wiring is unknown.

In this chapter, we study the solution of a message encrypted with the Hebern 1-rotor cipher machine where not only the rotor wiring is unknown (as in the previous chapter) but also where the Lampboard permutation is unknown.

We modify the method

When only the rotor was unknown, the reconstruction of a single basic cipher-text sequence was enough to reconstruct the entire machine.

Now, we must reconstruct several basic cipher-text sequences to find the Lampboard permutation which actually corresponds to the diagonals. In the previous chapter, the diagonals simply corresponded to the identity permutation (ABC...Z).

Example

Creating the encrypted message

We take the previous plain text (The Hound of the Baskervilles), and we encrypt it:
C:\H1_TOOLS> python hebern1_tui.py -R c5 -L RFS < MSGS\baskerville.pln > MSGS\basker2.cry

C:\H1_TOOLS> python groupe.py < MSGS\basker2.cry 
IYHTD UMQUD HZLHM KNWRU IHIKJ OZPNK PHCFQ YFZVZ XHMQZ XYKZM
VKLPN WERXY SJZCK PMGSR FIYUZ XRCDX MNUKG YKOZX TSKOA HTLMB
FNXOO XMHYS FEPSE AVJCC TOFAV GVLXO EPHNG ADGFN MQLBY AUQZO
MPNMR AEJZG CDBWK QHZMB YGIWH XVPWF YAIDV QTMXF WDZXE GTEBT
LERTM ETAHX NVIAR YHQGZ MDOBR RMOZH WEPBH CVPPW FTFHU RJSUU
LALAG MKERH AXLJP KERVY GYYWX OFITP FQVTR ONOCJ ULZFS DTIIZ
OCKQU COPWJ VWCVV DRDGG VJNZL TXORE VPUPI BBPNN GHHIQ YUMUI
RCNCX OXGOV WNOWI OZHBP UHLVM RCEKW BNTRI TFQFP NGDMB JMTWJ
...

Reconstruction of some basic cipher-text sequences

Using the interval method studied previously, we reconstruct the sequences corresponding to the three most frequent letters:

     a b c d e f g h i j k l m n o p q r s t u v w x y z
1)   A P V I G U F Y W S M Z K B N O L E T C Q H J I R D
2)   M N H E I R D N L T U A J K Y C F V Q G S P Z B X W
3)   H J C N D P X G F Q Z K B T F W J A S O M L V Y E U

Find the matching plain text letters

The reconstructed sequences correspond to the most frequent letters (E T A O N…). But which ones?

For the first sequence, there is little doubt, it is the most frequent (165), it is undoubtedly the letter E. On the other hand, the other sequences have similar frequencies (124, 119, 118, 115).

To find the plain text letters, simply start deciphering part of the cryptogram. To simplify, we will only show the method on the first letters:

key         : a b c d e f g h i j
cryptogramme: I Y H T D U M Q U D
plain text  : . . . . ? E . . . . 
The letter that precedes the letter E is almost certainly the letter T. This letter T corresponds to the third sequence which in fifth position gives the letter D. The probability of the bigram TE prevails over the probability of the other bigrams AE, OE. If we analyze a longer part we obtain certainty.

By doing a similar analysis, we associate the letter A with the second sequence.

Reconstruction of the lampboard permutation

We first construct part of the encryption table:

  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
A M       A   .                         H           .
B N     . P .                           J         .
C H   .   V                             C       .
D E .   . I                             N     .     .
E I   .   G                             D   .     .
F R .     U                             P .     .
G D       F                             X     .
H N       Y                           . G   .
I L       W                         .   F . 
J T       S                       .     Q           .
K U       M                     .       Z         .
L A       Z                   .         K       .
M J       K                 .           B     .
N K       B               .             T   .
O Y       N             .             . F .         .
P C       O           .             .   W         .
Q F       L         .             .     I       .
R Q       E       .             .       A     .
S V       T     .             .         S   .
T G       C   .             .           O .
U S       Q .             .             M
V P       H             .               L
W Z     . J           .                 V
X B   .   I         .                   Y
Y X .     R       .                     E
Z W       D     .                       U

Then, we list the partial sequences for the columns A and E:

I...A, R...P, D...V, N...I, L...G, T...U, U...F, A...Y
J...W, C...Z, F...K, Q...B, V...N, G...O, S...L, P...E
Z...T, B...C, X...Q, W...H, M...J, N...I, H...R, E...D,

Trying to reconstitute pieces of sequence:

 1)  N...I...A...Y
 2)  R...P...E...D...V...N
 3)  M...J...W...H...R
 4)  X...Q...B...C
 5)  C...Z...T...U...F...K
 6)  S...L...G...O

We can see that we can merge sequences 1, 2 and 3 as well as 4 and 5. In addition, the letter D is found in position 28 (26+2), therefore behind the M separated from an unknown letter.

   abcdefghijklmnopqrstuvwxyz
   M...J...W...H...R...P...E.
   ..D...V...N...I...A...Y
=  M.D.J.V.W.N.H.I.R.A.P.Y.E.

   X...Q...B...C...Z...T...U.
   ..F...K

   S...L...G...O

Two sequences were enough to reconstruct the Lampboard permutation as Friedman said. But if we have a third sequence, This allows us to verify our deductions.

 H..............X, Q..............P, W … (18) … X
 J..............G, G......M, W......L, F......N
 M......K, C..............D

It is now possible to reconstruct the encryption table and thus all “basic cipher-text sequences”. We remind you, the plain text letter is on the abscissa and the key (the position of the rotor) on the ordinate.

  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
A M S I X A T W Z O J B F R P N D G Y E H Q L C V U K
B N C M Z P K R Y F W D L G B X A T O S J I H Q E V U
C H U R G V L T D K X I A W M Z P Y N F C S J O Q E B
D E L A Q I P X V M C Z K U R G T B D H N F Y J O W S
E I Z J C G M Q U H R V E L A P W X S B D T F Y K N O
F R F H A U J E S L Q O I Z G K M N W X P D T V B Y C
G D S Z E F O N I J Y C R A V U B K M G X P Q W T H L
H N R O D Y B C F T H L Z Q E W V U A M G J K P S I X
I L Y X T W H D P S I R J O K Q E Z U A F V G N C M B
J T M P K S X G N C L F Y V J O R E Z D Q A B H U W I
K U G V N M A B H I D T Q F Y L O R X J Z W S E K C P
L A Q B U Z W S C X P J D T I Y L M F R K N O V H G E
M J W E R K N H M G F X P C T I U D L V B Y Q S A O Z
N K O L V B S U A D M G H P C E X I Q W T J N Z Y R F
O Y I Q W N E Z X U A S G H O M C J K P F B R T L D V
P C J K B O R M E Z N A S Y U H F V G D W L P I X Q T
Q F V W Y L U O R B Z N T E S D Q A X K I G C M J P H
R Q K T I E Y L W R B P O N X J Z M V C A H U F G S D
S V P C O T I K L W G Y B M F R U Q H Z S E D A N X J
T G H Y P C V I K A T W U D L E J S R N O X Z B M F Q
U S T G H Q C V Z P K E X I O F N L B Y M R W U D J A
V P A S J H Q R G V O M C Y D B I W T U L K E X F Z N
W Z N F S J L A Q Y U H T X W C K P E I V O M D R B G
X B D N F I Z J T E S P M K H V G O C Q Y U X L W A R
Y X B D C R F P O N G U V S Q A Y H J T E M I K Z L W
Z W X H L D G Y B A E Q N J Z T S F P O U C V R I K M

Decryption of the cryptogram

With the previous table, there is no problem to decipher the start of cryptogram:

key        : a b c d e f g h i j
cryptogram : I Y H T D U M Q U D ...
plain text : C H A P T E R M R S ...

Rotor wiring rebuild

If we know the Lampboard and a single "basic cipher text sequence", we can reconstruct the rotor wiring.

Note: Likewise, if we know the Lampboard permutation and only one basic cipher text sequence, we can deduce the set of basic ciphers text sequences. From them, we can decipher any text (this is what we did in the previous section).

First, we take a "basic cipher text sequence" and remove the influence of the Lampboard.

C:\H1_TOOLS> type a_basic_sequence.txt
YONDSWMAUZXFLQKGXVHRBTECJP
C:\H1_TOOLS> python striplamp.py TYOEUMXDFJQVKWBNSHCILRZAGP a_basic_sequence.txt
BCPHQNFXEWGIUKMYGLRVOADSJZ

Next, we create the encryption table:

  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
A                                   B D R K U S L E M
B                                   C Q J T R K D L
C                                   P I S Q J C K
D                                   H R P I B J
E                                   Q O H A I
F                                   N G Z H
G                                   F Y G
H                                   X F
I                                   E                          
....
If we complete the table, we obtain the wiring of the rotor in the first line:
  F Q T G X A N W C J O I V Z P H Y B D R K U S L E M

Reconstruction of the Rotor wiring (another approach)

If we know a basic-cipher-text-sequence and the Lampboard (RFS) we can deduce the wiring of the rotor.

  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
A M S I X A T W Z O J B F R P N D G Y E H Q L C V U K
B                                   O S J I H Q E V
C                                   N F C S J O Q 
D                                   D H N F Y J
E                                   S B D T F                                
F                                   W X P D 
G                                   M G X 
H                                   A M 
I                                   U 
J                                   
...

We remove the Lampboard permutation (we use the Identity rotor).

C:\H1_TOOLS> echo MSIXATWZOJBFRPNDGYEHQLCVUK \
	| python hebern1_tui.py -m -R identity -L =TYOEUMXDFJQVKWBNSHCILRZAGP -d
FQTGXANWCJOIVZPHYBDRKUSLEM