Kryha Cryptanalysis - Isomorphisms


Home Page
Kryha Home Page
Kryha Cryptanalysis Home Page

Introduction

In the book "Machine Cryptography and Modern Cryptanalysis", the autors, Deavours & Kruh [D&K] (see References), describe the use of isomorphs to find a Kryha key when the plaintext is known. The method can even be useful when tackling a single cryptogram.

The Isomorphism Phenomenon of the Kryha

If the same word is encrypted at a distance equal to a multiple of the number of sectors, the phenomenon of isomorphism occurs. The two encryptions of the same word are different, but they share characteristics that link these encryptions.

Here is an example:

- Plaintext: (in 17-letter segments, the number of sectors)
	tobeo rnott obeAA AA
	tobeo rnott obeAA AA

- Key:
  + Inner Alphabet: KPFQVGMASCHYNIORDELUBZWJXT 
  + Outer Alphabet: ZCJBWYKNAGQSPFTROXVMDULEHI
  + The standard wheel, initial sector: first sector

- Cryptogram (in 17-letter segments, the number of sectors)
	OCDQE HZXOS KSWFZ RH
	AFCWH QOEAP UPRZO SQ

Generally, because the cribs are "in phase," the gap between two letters of the cryptogram that are in the same column (then separated by a whole number of rows) has the same spacing (L) in the ciphertext alphabet (the inner alphabet) if the plain letters are identical.

In the example, we have a repeated crib, but the phenomenon exists even if we have isolated letters from the plaintext that are repeated "in phase".

The D&K Example

D&K provides an example (from a 1951 Kryha brochure) consisting of plaintext and its associated ciphertext. The phenomenon of Isomorphism allows them to find the key.

We assume that approximately half of the stops are positioned. Consequently, the most likely number of sectors is 26, 25, 24, … We first test the value 26.

First Attempt: Number of Sectors: 26

           12345 67890 12345 67890 12345 6
1st line : GHEHK VAZPV QGPCZ VXZTF XDEWJ Y    (Cryptogram)   
           THUSJ IFJEV ERYJP ERSON JONJE A    (Plaintext)  

2nd line : GPILW RMUBZ VRMYD CRTAX DAQZC X    (Cryptogram)   
           RTHJB UYSJT HEJKR YHAJM ACHIN E    (Plaintext)

3rd line : DJXMN EVALZ XKDSU EFWAG SMPJG W     ...
           SJTHE NJEAC HJOFJ THENJ CANJO B     

4th line : AHNLF TFSTI ILFVA CDAFI EUIOT D    
           TAINJ JTHEJ INCON CEIVA BLYJL A    

5th line : IBJRS QCHVV GAOII AXWCA MLXMN F
           RGEJN UMBER JOFJK EYJCH ANGES J

6th line : HZOTR QAOVA SRLHR XMDWS JZKMR U      
           WITHO UTJTW OJPER SONSJ EVERJ H      

7th line : BABOA YDZYQ ZGTBJ YRDUE EPWH
           AVING JTHEJ SAMEJ SYSTE MJJJ

We are looking for identical plaintext letters in different rows but "in phase" (in the same column). Due to the division into rows of 26 characters, the corresponding cipher letters are separated by a fixed interval in the internal alphabet.

- Lines 2 and 3, column 11 : V/H and X/H, then couple VX
                 column 17 : R/H and F/H, then couple RF
- Lines 3 and 4, column 25 : J/J and O/J, then couple JO
- Lines 4 and 5, column 09 : T/E and V/E, then couple TV
- Lines 5 and 6, column 06 : Q/U and Q/U, then couple QQ
- Lines 6 and 7, column 07 : A/T and D/T, then couple AD
                 column 14 : H/E and B/E, then couple HB
                 column 16 : X/S and Y/S, then couple XY
The pair QQ is impossible, therefore the partitioning is incorrect.

Number of sectors: 25, the inner alphabet

           12345 67890 12345 67890 12345 
1st line : GHEHK VAZPV QGPCZ VXZTF XDEWJ    (Cryptogram)   
           THUSJ IFJEV ERYJP ERSON JONJE    (Plaintext)  

2nd line : YGPIL WRMUB ZVRMY DCRTA XDAQZ    (Cryptogram)   
           ARTHJ BUYSJ THEJK RYHAJ MACHI    (Plaintext)

3rd line : CXDJX MNEVA LZXKD SUEFW AGSMP     ...
           NESJT HENJE ACHJO FJTHE NJCAN     

4th line : JGWAH NLFTF STIIL FVACD AFIEU    
           JOBTA INJJT HEJIN CONCE IVABL    

5th line : IOTDI BJRSQ CHVVG AOIIA XWCAM 
           YJLAR GEJNU MBERJ OFJKE YJCHA 

6th line : LXMNF HZOTR QAOVA SRLHR XMDWS     
           NGESJ WITHO UTJTW OJPER SONSJ      

7th line : JZKMR UBABO AYDZY QZGTB JYRDU 
           EVERJ HAVIN GJTHE JSAME JSYST 

8th line : EEPWH
           EMJJJ
- Lines 1 and 2, column 05 : K/J and L/J, then couple KL (1D)
                 column 14 : C/J and M/J, then couple CM
- Lines 2 and 3, column 14 : M/J and K/J, then couple MK
                 column 23 : A/C and S/C, then couple AS
- Lines 3 and 4, column 09 : V/J and T/J, then couple VT
                 column 20 : W/E and D/E, then couple WD
- Lines 4 and 5, column 08 : F/J and R/J, then couple FR 
                 column 20 : D/E and A/E, then couple DA
- Lines 5 and 6, column 16 : A/O and S/O, then couple AS
- Lines 6 and 7, column 03 : M/E and K/E, then couple MK
                 column 05 : F/J and R/J, then couple FR
                 column 24 : W/S and D/S, then couple WD
- Lines 7 and 8, column 00 : J/E and E/E, then couple JE
                 column 05 : R/J and H/J, then couple RH
--------------------------------------------------------
- Lines 3 and 5, column 07 : N/E and J/E, then couple N.J (2D)
                 column 22 : G/J and W/J, then couple G.W
                 column 23 : S/C and C/C, then couple S.C
- Lines 4 and 6, column 13 : I/J and O/J, then couple I.O
                 column 20 : A/E and B/E, then couple A.B
----------------------------------------------------------
- Lines 1 and 4, column 06 : V/I and N/I, then couple V..N (3D)
                 column 08 : Z/J and F/J, then couple Z..F
- Lines 2 and 5, column 13 : R/E and V/E, then couple R..V
                 column 24 : Q/H and A/H, then couple Q..A
- Lines 3 and 6, column 17 : U/J and R/J, then couple U..R
-----------------------------------------------------------
- Lines 3 and 7, column 06 : M/H and U/H, then couple M...U (4D)
------------------------------------------------------------
- Lines 1 and 6, column 04 : H/S and N/S, then couple HN (5D)
-----------------------------------------------------------
- Lines 1 and 7, column 21 : X/J and J/J, then couple XJ (6D)

D&K verbatim: There are several reasons to believe that this is the correct choice. Note the repeated digraphs MK, FR, and AS - all of which could hardly have originated by chance.

We have the following letter sequence (before decimation):

  • With 1D gaps:
    	CMKL, WDAS, VT, FRH, JE
    
  • With 2D and 3D gaps:
    	N.J, G.W, S.C, I.O, A.B, V..N, Z..F, R..V, Q..A, U..R
    	GQWDASBCMKL I.O ZU.FRH.VT.N.JE   (I.O round the N)
    
  • With 4D and 6D gaps:
    	M...U, X......J
    	GQWDASBCMKLZU.FRHXVTINOJE.
    

In a later section, we will discover that the value of decimation is 23. Let's take this value to understand the order of the letters of the internal alphabet.

column        012345 ....  25
1st line, Cry     K  ==> Ciphered alphabet advance from left to right
          Pln     J          +23 (= -3 modulo 26)

2nd line, Cry .K..L......................       
          Pln     J
Since the letters of the cipher alphabet advance from left to right, the resulting alphabet must be reversed: KL => LK .

Note: here, because L == 23 (the advancement at each period) is very large, the direction of the alphabet appears reversed.

Then, here the inner alphabet (before decimation):

	.EJONITVXHRF.UZLKMCBSADWQG

The External Alphabet

           12345 67890 12345 67890 12345 
1st line : GHEHK VAZPV QGPCZ VXZTF XDEWJ    (Cryptogram)   
           THUSJ IFJEV ERYJP ERSON JONJE    (Plaintext)  

2nd line : YGPIL WRMUB ZVRMY DCRTA XDAQZ    (Cryptogram)   
           ARTHJ BUYSJ THEJK RYHAJ MACHI    (Plaintext)

3rd line : CXDJX MNEVA LZXKD SUEFW AGSMP     ...
           NESJT HENJE ACHJO FJTHE NJCAN     

4th line : JGWAH NLFTF STIIL FVACD AFIEU    
           JOBTA INJJT HEJIN CONCE IVABL    

5th line : IOTDI BJRSQ CHVVG AOIIA XWCAM 
           YJLAR GEJNU MBERJ OFJKE YJCHA 

6th line : LXMNF HZOTR QAOVA SRLHR XMDWS     
           NGESJ WITHO UTJTW OJPER SONSJ      

7th line : JZKMR UBABO AYDZY QZGTB JYRDU 
           EVERJ HAVIN GJTHE JSAME JSYST 

8th line : EEPWH
           EMJJJ

We follow the same principle as before, but instead of searching for pairs of plaintext letters "in phase", we search for pairs of ciphertext letters "in phase" (i.e., in the same column).

- Lines 1 and 2, column 19 : T/O and T/A, then couple OA (1D)
                 column 21 : X/J and X/M, then couple JM
                 column 22 : D/O and D/A, then couple OA (confirmation)
- Lines 3 and 4, column 21 : A/N and A/I, then couple NI
- Lines 5 and 6, column 14 : V/R and V/T, then couple RT
                 column 21 : X/Y and X/S, then couple YS
--------------------------------------------------------
- Lines 4 and 6, column 09 : T/J and T/H, then couple J.H (2D)
----------------------------------------------------------
- Lines 2 and 5, column 20 : A/J and A/E, then couple J..E (3D)
                 column 21 : X/M and X/Y, then couple M..Y
- Lines 3 and 6, column 02 : X/E and X/G, then couple E..G
                 column 16 : S/F and S/O, then couple F..O 
- Lines 4 and 7, column 25 : U/L and U/T, then couple L..T
----------------------------------------------------------
- Lines 4 and 8, column 05 : H/A and H/J, then couple AJ (4D)
- Lines 1 and 6, column 11 : Q/E and Q/U, then couple EU (5D)
                 column 24 : W/J and W/S, then couple JS (5D)
- Lines 2 and 7, column 15 : Y/K and Y/E, then couple KE (5D)
                 column 19 : T/A and T/M, then couple AM (5D)
- Lines 2 and 8, column 03 : P/T and P/J, then couple TJ (6D)
  • From couples OA, JM, TJ (6D), AJ (4D)
    	TOA...JM
    
  • From couples J.H, RT, F..O, M..Y, YS, J..E
    	FRTOA...JMHEYS
    
    From couples EU (5D), KE(5D), , L..T, E..G
    	LFRTOA.K.JMHEYSG.U........
    

In a later section, we will discover that the value of decimation is 23. Let's take this value to understand the order of the letters of the external alphabet.

column        012345 ...19.....25
1st line, Cry            T  ==> Cry advance from left to right
          Pln         A..O    +23 (= -3 modulo 26)

2nd line, Cry            T       
          pln            A..O
Since the letters of the inner alphabet advance from left to right, the resulting outer alphabet rest the same: OA => OA (no need to reverse it).

Then, here the outer alphabet (before decimation):

	LFRTOA.K.JMHEYSG.U........

Note: D&K found a slightly different alphabet:

	TO.AK.-MHIYSG.U........LFR
The sign "-" corresponds to the word separator, here the letter J.

The alphabets (inner, outer, after decimation)

D&K: We have decimations of both the plain and cipher sequences at some unknown interval. If the decimation of on sequence is D, the interval for the other must be 26-D. Further, the decimation sequence is an odd number other than 13 or else a single chain count not have been obtained in both cases.

To find the correct decimation interval, we may test each candidate individually by writing the two decimated sequences out on strips and calculation the displacement necessary to shift from one plain/cipher pair to the adjacent pair.

Finally, the decimation interval is found to be 23.

Note: If the cryptanalyst knows which machine is being used and more specifically if it is the Kryha V2, the sum of the sectors is systematically equal to 23 and therefore the decimation value is also equal to 23. Indeed, the number of teeth is 179 regardless of the stops positioned, and 179 modulo 26 is equal to 23.

The inner alphabet:

	.EJONITVXHRF.UZLKMCBSADWQG
After decimation (23)
	.E......................J.
	.E................N..O..J.
	.E.............I..N..O..J.
	...  
	RECH.MXGKVQLTWZIDUNA.OSFJB
The outer alphabet:
	LFRTOA.K.JMHEYSG.U........
After decimation (23)
	L........................J.
	L...................R..F.J.
	L.............O..T..R..F.J.
	...
	LU...K.G..SA.YO.ET.HR.MF.J.
Note: D&K are wrong because they find a decimation value of 9. Here are the alphabets they find:
	Plain  (outer): TE.OY.AS..G.K...UL-.FM.RH.
	Cipher (inner): GXM.HCERBJFSO.ANUDIZWTLQVK
We can see that my solution corresponds (almost) to the alphabets found by D&K but reversed.

Reconstructing Sectors and Stops

As mentioned, the decimation value is calculated in parallel with the sector value calculation. At the same time, we are also completing the alphabets. Here are the values found with a decimation of 23:

Sector :  1  2  3  4  5  6  7  8  9 10 11 12
  shift:    6 10  7 10  3 10  7 11  7  3  7  6

Sector : 13 14 15 16 17 18 19 20 21 22 23 24 25
  Shift:    4  7  3  7  8  6  7 10  5  7  7  6 15
The universal disk contains 52 sectors. Here is the number of teeth contained in each of them.
             4,3,4,3,3,3,4,3,4,4,3,3,
             3,3,4,4,3,3,4,3,3,4,3,3,
             4,3,3,4,4,4,3,3,4,3,3,3,
             4,3,4,3,3,4,5,3,3,3,3,4,
             3,3,4,5
By comparing the value of the offsets and the value of the 52 sectors, we deduce the following values for the stops and the initial sector:
- Stops : 1,3,5,7,11,13,16,18,21,22,25,27,30,32,33,
          35,37,38,40,41,43,45,47,49,52 
- Initial sector : 11

Test the solution

Here is the complete key:

  • Inner Alphabet: RECHYMXGKVQLTWZIDUNAPOSFJB
  • Outer Alphabet: LUDIBKNGWXSAVYOQETPHRCMFZJ
  • Stops: 1,3,5,7,11,13,16,18,21,22,25,27,30,32,33,35,37,38,40,41, 43,45,47,49,52
  • Initial Sector: 11
  • Initial couple of letters (inner/outer): G/T

We test the solution with my simulator after correcting the cryptogram. The version given by D&K, which comes from a brochure, is incomplete and incorrect. In fact, in the last line, the following groups are partially illegible: UBAB? and AYD?Y. Similarly, the last group is incorrect: UEPWH.

$ cat MSGS/p162.cry
GHEHK VAZPV QGPCZ VXZTF XDEWJ YGPIL
WRMUB ZVRMY DCRTA XDAQZ CXDJX MNEVA
LZXKD SUEFW AGSMP JGWAH NLFTF STIIL
FVACD AFIEU IOTDI BJRSQ CHVVG AOIIA
XWCAM LXMNF HZOTR QAOVA SRLHR XMDWS
JZKMR UBABO AYDGY QZGTB JYRDU EEPWH

$ python3 kryha_tui.py \
	-i RECHYMXGKVQLTWZIDUNAPOSFJB \
	-e LUDIBKNGWXSAVYOQETPHRCMFZJ \
	-s 1,3,5,7,11,13,16,18,21,22,25,27,30,32,33,\
35,37,38,40,41,43,45,47,49,52 \
	-f 11 \
	-a GT \
	-d \
< MSGS/p162.cry | python3 groupe.py  | sed 's/J/-/g'

THUS- IF-EV ERY-P ERSON -ON-E ARTH- BUYS- THE-K RYHA- MACHI
NES-T HEN-E ACH-O F-THE N-CAN -OBTA IN--T HE-IN CONCE IVABL
Y-LAR GE-NU MBER- OF-KE Y-CHA NGES- WITHO UT-TW O-PER SONS-
EVER- HAVIN G-TVE -SAME -SYST EM---

Note: if we reverse and swap the inner and outer alphabets, and using encryption mode, we obtain the same decipherment.

$ python3 kryha_tui.py -s 1,3,5,7,11,13,16,18,21,22,25,27,30,\
32,33,35,37,38,40,41,43,45,47,49,52 \
    -e BJFSOPANUDIZWTLQVKGXMYHCER \
    -i JZFMCRHPTEQOYVASXWGNKBIDUL \
    -a TG -c  -f 11 < /tmp/p162.cry | python3 groupe.py

THUSJ IFJEV ERYJP ERSON JONJE ARTHJ BUYSJ THEJK RYHAJ MACHI
NESJT HENJE ACHJO FJTHE NJCAN JOBTA INJJT HEJIN CONCE IVABL
YJLAR GEJNU MBERJ OFJKE YJCHA NGESJ WITHO UTJTW OJPER SONSJ
EVERJ HAVIN GJTHE JSAME JSYST EMJJJ

Note: in fact this is the key that I deduced from the book by Deavours & Kruh and that I used (with a slight shift in the alphabets) in my page on the workings of Kryha.

References

  • Machine Cryptography and Modern Cryptanalysis, By Cipher A. Deavours & Louis Kruh, (1985), Artech House Publishers.
    Note: This book contains a chapter on Kryha. The example of the known plain attack described on this page is taken from that chapter.
  • Marks, P. 2011. Operational Use and Cryptanalysis of the Kryha Cipher Machine. Cryptologia 35(2): 114-155.