Hebern 1 rotor: The Konheim method


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

Introduction

Alan G. Konheim published in one of his books concerning cryptography a method that allows you to find the plain text associated with a cryptogram encrypted by the Hebern machine 1 rotor where only the wiring of the rotor is unknown.

The method

If T corresponds to the encryption of the plain letter S at the key A (or 0 in numerical notation), then, the expression (T – i) corresponds to the plain letter for the ith line (key i) for each key i from 0 (A) to 25 (Z).

If we follow the law of large numbers, the following formula applies:

	Chi[t,s] = SUM_FROM_i=0_TO_i=25 (PI[t-i] * NL[s][i] / N[i])
With:
	Chi[t,s] = probability of the plain letter 't' is ciphered by 
                   's' when the key (i) is zero.
	NL[s][i] = Number of letter 's'-i at the "i" key.
	N[i]     = Number of letters ciphered at the "i" key.
	PI[x]    = Probability of the plain letter "x".

Using Latex: \( X[t,s] = \sum_{t=0}^{25}\pi(t-i)( \frac{N_{s-i}(i)}{N(i)}) \sim 0.06875 \)

If the solution is correct, Chi[t,s] has a value close to 0.06875.

Note: Konheim uses the term column when personally I use the term line (to be consistent with my other web pages).

An example

We take the example taken by Konheim.

Here is the cryptogram, it is 650 characters long:

C:\H1_TOOLS> python groupe.py < MSGS\konheim.cry
RBLFO GZBKG CWUQF YDKIB KRFOL SFJMY XVLHD WFEYU IWHGU YBQSR
HHBOL KAGIX XKRIT JWDHR QCWRK DAEPC DYFRE KDXWW UOVRA RQXIH
BRINT JRRRY HDFCW SMKIC NNIDG OXDHN IWLBY TELCQ BMOXP WMSDS
ZEGLA EFFQP YLTBM KRWOO KDQJO DLWBK UAKOA PEEOB EHTVO OCNKR
RPVLL LIQBG YIJZY ZQKRG SGMRS DCBIE LYVZA GPETY WBGPE IJUIC
GVWCZ QTBCH ZFWVO ZHDIB SHMMN HTJDU FABTS SZFLH HVJDR QEMBK
PHELV HFYJD KXRIR MJMLC NVWGT SFVIS GPFRG OJRWI STJZZ XUBPW
LHWET JNCBJ WDLMP XLHTZ JNMAX MMKEE MXLEG ZLDXW COSLY EHXJN
CHJSC WQUEM QEJLI NZZCX ZWOJI QGVCN ICDWR DRMIB DOXYR VAJHC
IXGWU ZOHTR WGQSA XQNOZ SJZZR LNHUN EKPOO AQXIH LAVYC CIPHB
OBQHW BPDMC NKWCF YJRGE KCLYF VOLJS LXOHF EMKIZ FYJFV LXUIY
FGRFI QILTK QQHKC PIKLA VCXPZ ADUWP ISUTL XPYUX USFRD MMABH
XDZXX BUJJG AQFYD KOEJU KTGJP TFPZJ YBEOT OMKPL YVRST RNBAQ

Show program syntax:

C:\H1_TOOLS> python konheim.py
konheim: search of probability of a plain letter
         is ciphered by a specific letter at key 0
Syntax: konheim.py language cryptogram plain_letter
We launch the attack by looking for the encrypted letter in position A corresponds to the letter E. The highest value found (0.0844) corresponds to the letter X.
C:\H1_TOOLS> python konheim.py english MSGS\konheim.cry E
Plain letters probability:  [0.0834, 0.0144, 0.0273, 0.0414, 0.126] ...
cryptogram :  RBLFOGZBKGCWUQFYDKIBKRFOLSFJMYXVLHDWFEYUIWHGUYBQSR ...
Cryptogram Length :  650
Plain letter:  E
E -> a 0.0525    E -> b 0.0533   E -> c 0.0496   E -> d 0.0411   E -> e 0.0297
E -> f 0.0421    E -> g 0.0448   E -> h 0.0495   E -> i 0.0459   E -> j 0.0385
E -> k 0.0335    E -> l 0.0268   E -> m 0.0244   E -> n 0.0325   E -> o 0.0357
E -> p 0.0324    E -> q 0.0281   E -> r 0.0348   E -> s 0.0268   E -> t 0.0386
E -> u 0.0290    E -> v 0.0265   E -> w 0.0270   E -> x 0.0844   E -> y 0.0343
E -> z 0.0369

The program uses the probabilities of the letters present in the file STATS\english.proba if the language used is "english".

C:\H1_TOOLS> more STATS\english.proba 
A,0.0834      G,0.0192      L,0.0424      Q,0.0009      V,0.0106
B,0.0144      H,0.0611      M,0.0253      R,0.0568      W,0.0234
C,0.0273      I,0.0671      N,0.0680      S,0.0611      X,0.0020
D,0.0414      J,0.0023      O,0.0770      T,0.0937      Y,0.0204
E,0.1260      K,0.0087      P,0.0166      U,0.0285      Z,0.0006
F,0.0203

Then, we search for the value of the other letters of the alphabet starting by the most frequent letters (T,A,O,N,S):

...
Plain letter:  T
T -> a 0.0525    T -> b 0.0310   T -> c 0.0409   T -> d 0.0397   T -> e 0.0385
T -> f 0.0371    T -> g 0.0443   T -> h 0.0255   T -> i 0.0388   T -> j 0.0278
T -> k 0.0418    T -> l 0.0453   T -> m 0.0225   T -> n 0.0528   T -> o 0.0292
T -> p 0.0304    T -> q 0.0329   T -> r 0.0584   T -> s 0.0290   T -> t 0.0454
T -> u 0.0384    T -> v 0.0293   T -> w 0.0435   T -> x 0.0543   T -> y 0.0323
T -> z 0.0367
...
Plain letter:  A
A -> a 0.0463    A -> b 0.0366   A -> c 0.0382   A -> d 0.0247   A -> e 0.0348
A -> f 0.0599    A -> g 0.0444   A -> h 0.0394   A -> i 0.0540   A -> j 0.0335
A -> k 0.0448    A -> l 0.0292   A -> m 0.0272   A -> n 0.0303   A -> o 0.0352
A -> p 0.0232    A -> q 0.0421   A -> r 0.0321   A -> s 0.0333   A -> t 0.0402
A -> u 0.0344    A -> v 0.0329   A -> w 0.0384   A -> x 0.0660   A -> y 0.0344
A -> z 0.0430
…
Plain letter:  O
O -> a 0.0411    O -> b 0.0439   O -> c 0.0481   O -> d 0.0494   O -> e 0.0418
O -> f 0.0347    O -> g 0.0544   O -> h 0.0412   O -> i 0.0393   O -> j 0.0297
O -> k 0.0448    O -> l 0.0253   O -> m 0.0425   O -> n 0.0285   O -> o 0.0361
O -> p 0.0406    O -> q 0.0380   O -> r 0.0273   O -> s 0.0320   O -> t 0.0495
O -> u 0.0330    O -> v 0.0244   O -> w 0.0299   O -> x 0.0454   O -> y 0.0283
O -> z 0.0493
...
Plain letter:  N
N -> a 0.0350    N -> b 0.0504   N -> c 0.0458   N -> d 0.0371   N -> e 0.0437
N -> f 0.0453    N -> g 0.0452   N -> h 0.0325   N -> i 0.0230   N -> j 0.0237
N -> k 0.0491    N -> l 0.0355   N -> m 0.0383   N -> n 0.0362   N -> o 0.0243
N -> p 0.0388    N -> q 0.0408   N -> r 0.0343   N -> s 0.0210   N -> t 0.0526
N -> u 0.0319    N -> v 0.0247   N -> w 0.0278   N -> x 0.0572   N -> y 0.0219
N -> z 0.0824
...
Plain letter:  S
S -> a 0.0492    S -> b 0.0410   S -> c 0.0408   S -> d 0.0801   S -> e 0.0471
S -> f 0.0233    S -> g 0.0550   S -> h 0.0312   S -> i 0.0424   S -> j 0.0459
S -> k 0.0402    S -> l 0.0296   S -> m 0.0357   S -> n 0.0288   S -> o 0.0334
S -> p 0.0314    S -> q 0.0334   S -> r 0.0342   S -> s 0.0324   S -> t 0.0470
S -> u 0.0200    S -> v 0.0241   S -> w 0.0452   S -> x 0.0429   S -> y 0.0306
S -> z 0.0336

In partial conclusion, we obtain, for the effective key A, the letters numbers corresponding to the most frequent plain text letters:

	E->x 
	T->r (but the letters A and Z give plausible values)
	A->x (Konheim finds the letter F)
	O->z (Konheim finds the letter P)
	N->z
	S->D

Note: Slightly different results are obtained from those of Konheim. I think it comes from the statistics used.

We do the same for the other letters.

Reference

  • COMPUTER SECURITY AND CRYPTOGRAPHY, by Alan G. Konheim, from Wiley, 2007.