Kryha Cryptanalysis - Friedman's method


Home Page
Kryha Home Page
Kryha Cryptanalysis Home Page

Introduction

A.M. Evalenko purchased the rights to the Kryha in 1932. Early the following year, his lawyer, Robert C. Birkhahn, offered the Kryha system to the US Army Signal Corps.

This service had already studied the machine and deemed it insecure (Parker Hitt's feats). Evalenko persisted, and as a result, the US Army Signal Corps accepted a challenge: to break a 200-word (1,000-characters) message.

The Signal Intelligence Service (SIS) carried out this mission. On February 1st, Birkhahn presented a 1,135-character cryptogram. Friedman and his team, consisting of Kullback, Rowlett, and Sinkov, found the machine's key and deciphered the cryptogram in 2 hours and 41 minutes. Needless to say, the Army, after this feat declined the offer to use the Kryha as a cryptographic tool.

Important note: it should be noted that Friedman had detailed knowledge of the Kryha machine and knew the details of the wheel used: it was the standard wheel.

A simple invented example

Introduction

To better understand Friedman's method, I encrypted a plaintext randomly generated from a pseudo-language composed of only two letters (E and T). The letter E had a probability of 66% and the letter T a probability of 33%.

I used the following key:

  • Starting sector : 3
  • Interior alphabet: KPFQVGMASCHYNIORDELUBZWJXT
  • Exterior alphabet: ZCJBWYKNAGQSPFTROXVMDULEHI

$ cat /tmp/genere.py
import random

for i in range(1000):
    x = random.random()
    if x > 0.33:
        print("E", end="")
    else:
        print("T", end="")
print()

$ python3 /tmp/genere.py > /tmp/toto.txt

$ more /tmp/toto.txt
TEEETTEEEEETEEEEETEEETEEEETTEEEEEEEEEEEEEETTEEEEEEEETTETEETEEEEEEETEEEEE
EEEEEEEEEEETEEEEEEEETEEETEEEETTTTEETEEETEEEETTEEEEETTETEEETTTEEETETEEETT
TEETEETTTEEEEETEETTEEEEETTEETEETTETEETEETEEETEETEEEEEEEETTEETETTEEEETEEE
EEEETEEETETEETEEETETETTEETEEEEEEEETTEEEEEEEETEEEEEETETEETEEETEETEETEETEE
ETETEEEEETEEEEEEEEETETETEEETTETTEETETEEETEEEEEEETEETTEETTEEETTEETEEEEEEE
EEETEETETEEEEETEETETTTTTTETEETETETTETTETETETEEETEETEEEEEEEEEETEETTEEEEEE
TEEEEETEEEEEEEEEEEEEEEETTTEETEEETETETTTETETTEETEEEEETEEEETTETEEEEETEETEE
EETETTEEEEEEETEEETTEETEEETTETEEEETEEEEEEEEEEETTETEEETEETEETEETETEEEETEEE
ETTEEEETETEETEEETETETEEEEEEETTEEETEETEEETTEEEETEEETTTTETTEETEEETEEEETEEE
EEETEEEEETTTEETTTTEETTETEEEEEETEEEEEEEEEEEEEEEEETEETTEEEEEEEETEEEETEEEET
TETEETETEEETEEETEEEEETEEETTTEEEETEEEEEEEEETTTTTEETTEETEEEEEEEETETETETTEE
EEEETTETETEETTEEEEETETTTEEEETTEEETEEETETEETTEEEEETEETETTETEEETEEETTETEET
EEEEEEETEETTETETTEEEETETTEEETTETTETEETEETTEEEETTEEEETTTEEETTETEEEEETEEET
ETETTETEEETTTTTETTTTETEETEEEETETEEEEETTEEEEETETEETTTEEEEETEEEEEE

$ python3 kryha_tui.py -o -f 3 -i KPFQVGMASCHYNIORDELUBZWJXT \
-e ZCJBWYKNAGQSPFTROXVMDULEHI < /tmp/toto.txt >| /tmp/titi.cry

$ python groupe.py < /tmp/titi.cry
ODYGR CHVBR CZJEN QWACV XSYQJ ITUJD HGWRC FJEHV WDJLZ DCQXR
SFNAH BJRKT BOCFW ETPZO CQWDS FLIAF ZRHLB OAFWR CPNYM KNOSQ
BVXEN RSUBO VDUOA PIVMK UOSLN IXJLN XEYRM THNXP BOJEA YGEUI
TDCNG KBIXT UKZXU NMPCF GXHIM ECNUJ EQGTY YVXSN MDUYG ZDHGX
CVVJS HWDLN VXGCQ XEYMJ AHQXC YWJEX FWEPV DDKBW EFVXD HKZRH
BOLCF WRHVJ SCQUO SQIDF FZMSQ JAHFI NALWR KVZOT PIDCQ ZRWKB
RSFJO APYRK FIOSX HVSLN DAEBV SFZMA PENMP BGCKH VMPNG SKBPW
TBVAF UNMTB OAPHI QRLVM KZNGD LIXKY QJISF MDUOW XCYJE UVWTM
HZTCN AXSYV DUNMX LSQJL YWKEP ZJLNG TEFPW DYVRU HQJDY GXLHV
BRCVJ SQBWD KVXEF QOITU ODPGI MCFOE HVWDJ PZDCB RRTFZ DHQOR
CDBOC FIETL ZOCQW DSULI AUNRH LBOAU IRKPZ YMEZO SQBIA KZRSU
YOZTU OXPWV MKHOS LZVAJ LNXKB RMDHN APBGM EDYWK UITTC NWKBI
ATUCZ RUNML LYWXU IJELN FJSNG TYFZR EQJTU FGZDP GXLIZ JEHGT
LQVXO CQRSF MJAPB RLYWO EXFWE HVTAC QWEYV XDHKZ RHQJL CUWRP
ZJECQ UOSQI DYFZM SQJDP UWQAP IRKVZ OTPWD KQZRG KYRSF OGXPB
RCUWO SXUIS PZAXE YVSFN MAPSN MPBOC KUVML ZGSEY HGTBI AUHNJ
TYOAL HIQXL IJKNQ WTLIA EYNMW SYMTH OWXLF JKUIG TMHVD LQXXS
YVTHN MXCTQ OLYWK EHVJL NWTEF LWAYZ RUHQJ AYWRL HVYMC ZOEQQ
WACVR SYQJI TUJDH GIMKF JEPZW AMPZD CBXRS UZAHB ORKTB OKUIS
TPNGK BWASF CIAFZ MHLBO AFWMK PZYMK NOTQB VXEZR SFBGV TUOAP

Finding the initial position of the wheel

If we know the wheel's position, we can calculate the offsets for each wheel position.

Note: The method for determining the starting sector is described on another page (link).

In our example (see below), the starting sector is the 3rd. This position has the largest value (0.56) which is characteristic of our pseudo-language.

$ python3 friedman_start.py -c /tmp/titi.cry
Wheel: [7, 6, 7, 5, 6, 7, 6, 8, 6, 10, 5, 6, 5, 7, 6, 5, 9]  Sector:  0

  1: 0.104360
  2: 0.127294
  3: 0.562183
  4: 0.127161
  5: 0.103895
  6: 0.119773
  7: 0.107508
  8: 0.078087
  9: 0.096923
 10: 0.130465
 11: 0.117515
 12: 0.117167
 13: 0.131459
 14: 0.095103
 15: 0.073939
 16: 0.101685
 17: 0.114586

]

Group the letters of each alphabet

Once the starting position of the wheel has been found, the letters of the cryptogram can be distributed in a table with X columns (as many columns as there are sectors on the wheel, 17 for the standard wheel) and 26 rows. Then, the columns can be combined to obtain a single column where each element corresponds to the letters of the cryptogram of a single alphabet corresponding to a particular shift (the existing shift between the two alphabets of the machine, i.e., inner and outer).

$ python3 friedman_end.py -c /tmp/titi.cry -w 7,5,6,7,6,8,6,10,5,6,5,7,6,5,9,7,6
    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
 0: 0  0  0  0  0  0  0  0  0 29  0  0  0  0 11  0  0  0  0  0  0  0  0  0  0  0
 1: 0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0  0  0  0  0  0  0 27  0  0  0
 2: 0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0  0  0  0  0  0 29
 3: 0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0
 4: 0  0  0  0  0  0  0 11  0  0  0  0  0  0  0  0  0  0  0  0 24  0  0  0  0  0
 5: 0  0 11  0  0  0  0  0  0  0  0 25  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 6: 0  0  0  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0
 7:14  0  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 8: 0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0 30  0  0  0  0  0  0  0  0
 9: 0  0  0  0  0  0  8  0  0  0  0  0  0  0 32  0  0  0  0  0  0  0  0  0  0  0
10: 0  0  0  0  0  0  0  0 23  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0
11: 0  0  0  0  0  0  0  0  0  0  0  0  0 26  0  0  9  0  0  0  0  0  0  0  0  0
12: 0  0  0  0  0 11  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 26  0
13: 0  0  0  0  0  0  0 30  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0  0  0  0
14: 0  0 28  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
15: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 27 13  0  0  0  0  0  0
16:24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0
17: 0  0  0  0  0  0  0  0  0 10  0  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0
18: 0  0  0  0  0  0 20  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 16  0  0  0
19: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 27  0  0  0 12
20: 0  9  0  0  0  0  0  0  0  0  0  0  0  0  0  0 31  0  0  0  0  0  0  0  0  0
21: 0  0  0  0  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0 15  0  0  0  0  0
22: 0  0  0  0  0  0  0  0  0  0  0 13  0  0  0 26  0  0  0  0  0  0  0  0  0  0
23: 0  0  0  0 14  0  0  0  0  0 22  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
24: 0  0  0 11  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 25  0  0  0  0  0  0
25: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0 26  0  0
...

In the first table (equivalent to Fig. 9 in Callimahos's article), each row corresponds to the distribution of the cryptographic letters for each of the 26 alphabets. If we take the first row, for example (the first alphabet), the letter J has 29 occurrences and the letter O 11 occurrences. We can confidently conclude that the letter J corresponds to the plaintext letter E, and the letter O corresponds to the letter T. If we analyze the other alphabets (the other rows), we consistently find two letters that correspond to E and T. Even though we can deduce the meaning of the cryptographic letters in each case, we observe that the intervals between the two letters vary. Therefore, in a realistic situation (where all the letters are represented), it is very difficult to combine the different alphabets.

Find similar but offset alphabets

 A: 0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 24  0  0  0  0  0  0  0  0  0 : 38
 B: 0  0  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0 : 36
 C: 0  0  0  0  0 11  0  0  0  0  0  0  0  0 28  0  0  0  0  0  0  0  0  0  0  0 : 39
 D: 0  0  0  0  0  0  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0 : 38
 E: 0  0  0  0  0  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0 : 38
 F: 0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0  0 27  0  0  0  0 : 38
 G: 0  0  0  0  0  0  0  0  0  8  0  0  0  0  0  0  0  0 20  0  0  0  0  0  0  0 : 28
 H: 0  0  0  0 11  0  0  0  0  0  0  0  0 30  0  0  0  0  0  0  0  0  0  0  0  0 : 41
 I: 0 13  0  0  0  0  0  0  0  0 23  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 : 36
 J:29  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 10  0  0  0  0  0  0  0  0 : 39
 K: 0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 22  0  0 : 36
 L: 0  0  0  0  0 25  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0 : 38
 M: 0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0  0 26  0  0  0  0  0  0  0  0 : 37
 N: 0  0 12  0  0  0  0  0  0  0  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0 : 38
 O:11  0  0  0  0  0  0  0  0 32  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 : 43
 P: 0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0  0 26  0  0  0 : 35
 Q: 0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0  0 31  0  0  0  0  0 : 40
 R: 0  0  0  0  0  0  0  0 30  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11 : 41
 S: 0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 27  0  0  0  0  0  0  0  0  0  0 : 41
 T: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0  0 25  0 : 38
 U: 0  0  0  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 15  0  0  0  0 : 39
 V: 0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 27  0  0  0  0  0  0 : 41
 W: 0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 16  0  0  0  0  0  0  0 : 43
 X: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 26 : 40
 Y: 0  0  0 12  0  0  0  0  0  0  0  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0 : 38
 Z: 0  0 29  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0 : 41
...

In the second table (equivalent to Fig. 10 of Callimahos), each index of a row corresponds to a different letter of the cryptogram. Then, we have the distribution of this letter, and each column contains the numbers of the letter for one alphabet.

As before, each line corresponds to a letter of the alphabet. Within each line, there are two letters that clearly correspond to the letters E and T in the plaintext. However, unlike the previous table, the interval between the two letters is identical (9 characters). Therefore, we observe that the alphabets are identical from one line to the next, except that they are shifted.

Note: The last column correspond to the numbers of letters in the row. Thus there are 38 A's in the cryptogram.

Finding the shifts

If we determine the shifts of the alphabets using a Chi-square analysis, we can group the 26 alphabets identified by each letter (A, B, C) of the ciphertext. The third table therefore shows the 26 alphabets aligned in descending order of letter frequency (WOZ...). The last column is the shift of each alphabet.

Note: To find the shifts, we use the Chi-square method. This method can be used in a simple or more complex way. Personally, I compared each alphabet to the alphabet with the most letters, in descending order of frequency. Friedman used a more ingenious manual method, but one that is more difficult to automate.

W:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 16  0  0  0  0  0  0  0 , 0
O:  0 32  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 , 8
Z:  0 29  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0  0 , 1
V:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 ,18
S:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 ,14
R:  0 30  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 , 7
H:  0 30  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 ,12
X:  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 ,24
Q:  0 31  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0 ,19
U:  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 15  0  0  0  0  0  0  0 , 3
J:  0 29  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 10  0  0  0  0  0  0  0 ,25
C:  0 28  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 ,13
Y:  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0  0 ,11
T:  0 25  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0 ,23
N:  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0  0 ,10
L:  0 25  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0 , 4
F:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 ,20
E:  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 , 5
D:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 , 6
A:  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 ,15
M:  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 ,16
K:  0 22  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 ,22
I:  0 23  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0 , 9
B:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0 , 2
P:  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0 ,21
G:  0 20  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  8  0  0  0  0  0  0  0 ,17
...

Finding the inner alphabet

The letters that index each alphabet are sorted in descending order of their shifts. We'll start with the most frequent letters. The result is the machine's internal alphabet.

 0 O:11  0  0  0  0  0  0  0  0 32  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0: 8
 1 R: 0  0  0  0  0  0  0  0 30  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11: 7
 2
 3
 4
 5 U: 0  0  0  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 15  0  0  0  0: 3
 6
 7 Z: 0  0 29  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0: 1
 8 W: 0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 16  0  0  0  0  0  0  0: 0
 9
The diagonals are beginning to appear. We obtain part of the inner alphabet: OR...U.ZW. If we continue the process, we obtain the complete alphabet.

Note: If there is insufficient data, the found internal alphabet will be incomplete and partially incorrect.

...
Interior Alphabet:  WJXTKPFQVGMASCHYNIORDELUBZ , Collision:  False

Decipher the cryptogram using the internal alphabet

The next step involves deciphering the cryptogram using the found inner alphabet. We obtain gibberish, but the calculation of the decipherment's IC (Index of Computing) gives 0.57. This is (almost) the IC we obtained when searching for the starting sector of the wheel. Therefore, we have a simple substitution. It is easy to find the plaintext.

The decipherment yields a sequence of S's and B's, with B's having a frequency of 66% and S's a frequency of 33%, where the letter B corresponds to the letter E, and the letter S to the letter T.

$ python3 kryha_tui.py -o -i WJXTKPFQVGMASCHYNIORDELUBZ -f 3 -d < /tmp/titi.cry
SBBBSSBBBBBSBBBBBSBBBSBBBBSSBBBBBBBBBBBBBBSSBBBBBBBBSSBSBBS...

Finding the outer alphabet

Finally, finding the outer alphabet is simple when we have the plaintext and the corresponding ciphertext.

Solution with only the outer alphabet unknown

If the inner alphabet is ABC...Z, the second table (Fig. 10 of Callimahos) shows a regular shift of the alphabets. This allows us to deduce the value of this inner alphabet, which is the normal alphabet (ABC...Z) or any normal alphabet simply shifted (for example, BCD...ZA).

It's enough to decipher the cryptogram by specifying only the starting sector without specifying any alphabets. The decipherment is characterized by an IC (Index of Coincidence) characteristic of the language. This indicates that it's a simple substitution cipher very easy to break.

$ python3 kryha_tui.py -o -f 3 -e ZCJBWYKNAGQSPFTROXVMDULEHI \
 < /tmp/toto.txt >| /tmp/titi2.cry

$ python groupe.py < /tmp/titi2.cry | head -5
OQLFP JKEUP JVXRM DWHJE YILDX NZTXQ KFWPJ CXRKE WQXSV QJDYP
ICMHK UXPAZ UOJCW RZBVO JDWQI CSNHC VPKSU OHCWP JBMLG AMOID
UEYRM PITUO EQTOH BNEGA TOISM NYXSM YRLPG ZKMYB UOXRH LFRTN
ZQJMF AUNYZ TAVYT MGBJC FYKNG RJMTX RDFZL LEYIM GQTLF VQKFY
JEEXI KWQSM EYFJD YRLGX HKDYJ LWXRY CWRBE QQAUW RCEYQ KAVPK

$ python3 kryha_tui.py -o -f3 -d < /tmp/titi2.cry >| /tmp/titi2.txt

$ cat /tmp/titi2.txt
OXXXOOXXXXXOXXXXXOXXXOXXXXOOXXXXXXXXXXXXXXOOXXXXXXXXOOXO...

$ python ic.py /tmp/titi2.txt
0.570258258258

$ python3 friedman_end.py -c /tmp/titi2.cry -w 7,5,6,7,6,8,6,10,5,6,5,7,6,5,9,7,6
    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
 0: 0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0  0 29  0  0
 1: 0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0  0 27  0  0  0
 2: 0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0  0  0 29  0  0  0  0
 3: 0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0  0  0 27  0  0  0  0  0
 4: 0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0  0 24  0  0  0  0  0  0
 5: 0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0  0 25  0  0  0  0  0  0  0
 6: 0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 24  0  0  0  0  0  0  0  0
 7: 0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 27  0  0  0  0  0  0  0  0  0
 8: 0  0  0  0  0  0 11  0  0  0  0  0  0  0  0 30  0  0  0  0  0  0  0  0  0  0
 9: 0  0  0  0  0  8  0  0  0  0  0  0  0  0 32  0  0  0  0  0  0  0  0  0  0  0
10: 0  0  0  0 14  0  0  0  0  0  0  0  0 23  0  0  0  0  0  0  0  0  0  0  0  0
11: 0  0  0  9  0  0  0  0  0  0  0  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0
12: 0  0 11  0  0  0  0  0  0  0  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0
13: 0  9  0  0  0  0  0  0  0  0 30  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
14:14  0  0  0  0  0  0  0  0 28  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
15: 0  0  0  0  0  0  0  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13
16: 0  0  0  0  0  0  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0
17: 0  0  0  0  0  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 10  0  0
18: 0  0  0  0  0 20  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 16  0  0  0
19: 0  0  0  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0
20: 0  0  0 31  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0
21: 0  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 15  0  0  0  0  0  0
22: 0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0
23:22  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0
24: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0  0 25
25: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0  0 26  0

 A: 0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 22  0  0 : 36
 B: 0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0  0 26  0  0  0 : 35
 C: 0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0  0 27  0  0  0  0 : 38
 D: 0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0  0 31  0  0  0  0  0 : 40
 E: 0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 27  0  0  0  0  0  0 : 41
 F: 0  0  0  0  0  0  0  0  0  8  0  0  0  0  0  0  0  0 20  0  0  0  0  0  0  0 : 28
 G: 0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0  0 26  0  0  0  0  0  0  0  0 : 37
 H: 0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 24  0  0  0  0  0  0  0  0  0 : 38
 I: 0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 27  0  0  0  0  0  0  0  0  0  0 : 41
 J: 0  0  0  0  0 11  0  0  0  0  0  0  0  0 28  0  0  0  0  0  0  0  0  0  0  0 : 39
 K: 0  0  0  0 11  0  0  0  0  0  0  0  0 30  0  0  0  0  0  0  0  0  0  0  0  0 : 41
 L: 0  0  0 12  0  0  0  0  0  0  0  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0 : 38
 M: 0  0 12  0  0  0  0  0  0  0  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0 : 38
 N: 0 13  0  0  0  0  0  0  0  0 23  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 : 36
 O:11  0  0  0  0  0  0  0  0 32  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 : 43
 P: 0  0  0  0  0  0  0  0 30  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11 : 41
 Q: 0  0  0  0  0  0  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0 : 38
 R: 0  0  0  0  0  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0 : 38
 S: 0  0  0  0  0 25  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0 : 38
 T: 0  0  0  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 15  0  0  0  0 : 39
 U: 0  0  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0 : 36
 V: 0  0 29  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0 : 41
 W: 0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 16  0  0  0  0  0  0  0 : 43
 X:29  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 10  0  0  0  0  0  0  0  0 : 39
 Y: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0  0 26 : 40
 Z: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0  0 25  0 : 38

22
[[22, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], 
[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], 
[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]
[[22, 0], [14, 8], [21, 1], [15, 7], [10, 12], [8, 14], [4, 18], [24, 24], [3, 19], 
[23, 25], [19, 3], [9, 13], [25, 23], [18, 4], [17, 5], [16, 6], [12, 10], [11, 11], 
[7, 15], [2, 20], [6, 16], [20, 2], [13, 9], [0, 22], [1, 21], [5, 17]]

W:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 16  0  0  0  0  0  0  0 , 0
O:  0 32  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 , 8
V:  0 29  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0  0 , 1
P:  0 30  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 , 7
K:  0 30  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 ,12
I:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 ,14
E:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 ,18
Y:  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 ,24
D:  0 31  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0 ,19
X:  0 29  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 10  0  0  0  0  0  0  0 ,25
T:  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 15  0  0  0  0  0  0  0 , 3
J:  0 28  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 ,13
Z:  0 25  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0 ,23
S:  0 25  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0 , 4
R:  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 , 5
Q:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 , 6
M:  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0  0 ,10
L:  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 12  0  0  0  0  0  0  0 ,11
H:  0 24  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 ,15
C:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 ,20
G:  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 11  0  0  0  0  0  0  0 ,16
U:  0 27  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0 , 2
N:  0 23  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 13  0  0  0  0  0  0  0 , 9
A:  0 22  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 14  0  0  0  0  0  0  0 ,22
B:  0 26  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  9  0  0  0  0  0  0  0 ,21
F:  0 20  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  8  0  0  0  0  0  0  0 ,17
Interior Alphabet:  WXYZABCDEFGHIJKLMNOPQRSTUV , Collision:  False

$ python3 kryha_tui.py -o -f3 -d -i WXYZABCDEFGHIJKLMNOPQRSTUV \
  < /tmp/titi2.cry >| /tmp/titi2.txt

$ python ic.py /tmp/titi2.txt
SBBBSSBBBBBSBBBBBSBBBSBBBBSSBBBBBBBBBBBBBBSSBBBBBBBBSSBSBBSB...
0.570258258258

The letter S correspond to the T letter and B to the E letter.

Analysis of the 1135-character message broken by Friedman

The Cryptogram

	$ more MSGS/2h.cry

	XYICP NDEAM APDTR AXXPZ XHYRY TWQXF
	HCDJK AHQUR ZPPPZ QOFUV KFEMN EAONG
	TTXSV VUBDG JREJF HEOKV CQHFH ROKUP
	MQPQW ACOJC RLMBM EVKRV JDYNN SXUDL
	HNPFW MOCMJ FLGPM BKHAU XLIVV QSXUN
	JZUKK OBAAE UQOJY IZSZU HGWGW ATEJW
	YDIVX PEIKE ECMCI RXXLA ZLAIN MJZXI
	CIDKQ KMMTE LLFJT JUBQO LJAWM FEHEV
	SYCAS KFONO ZUMPA DAPJY LPFNT RUITC
	BWHJH MOLCV RDEPF QACIU HCZCB XTOKC
	IXGOS GCMRF HJVXS VZNMU GJJSO QBJQH
	BQNLH RTMEL YNHKU FXJDM JYCPA DPPWY
	MGUWO IAIIG PTSFC SOKID GGTYO AAQDR
	QRRMN TSHYN EXYVF CMJJK NXVTE FXAUT
	SEZQS HLULP CYGXO NLAWQ TEJNB SMVTE
	HSXUY NJKXF PEPGF CMMCW ZRPJY GOPZU
	ZNVXI AXZKQ MJEFW WMRQR TETPX RSUKC
	DLHED LLCTJ KXZMQ MKNJU VPFLY HYFQR
	EWNDZ MBMPB OJXEQ IZAXH NDBQQ WDIZQ
	PIFAY JGQJO FWFCD BXYNX YTWYK EQCDP
	DYDOZ HJFCZ UEDDJ BFXTT VFYGH CTBGO
	FEHBU BZDQQ TIGDY AIYFD FHABS AHYGX
	IBBLE CGOSE MOMZV KHQSI CMJFF EVVTL
	WTESL AYWFY CKOXP SVNAI GOCZZ KVVVJ
	SOPEN YXDDX LDCYA XMWWO CWOII BNXTV
	TLIVQ WXUET PSUHC SOYFP VYIKZ NFVIE
	YPHKI NCGGV IKROO SOVMG HKUNU SUNYV
	CFELO OWSAI YRREV NEXPE SEGRP ZNBMM
	YUZFG SXRXW MNWTL RHVFH GSXMW VREAJ
	DGOZA GRXKJ LDOGY PTYXN TMWQM YSQWL
	XHNGZ QDMCW PYATG NZFJK WFDKA VSJMH
	JGWJE CWTDB ZNMYT NAORV HARRP DXGCA
	PHJNZ KTLQR QJJAF FZGDX LRFFS AWSZN
	GLSAQ GMCDY JGMBL SXEOT LFJGG LGKKR
	YYWDA LHHJV CGYVR LYSPJ VPKGW WXHFA
	CMTRG UJEJW TAFSN ZXVVW IYWOO MTLUF
	SBCAJ RNRMP IYLWI KAOKH TMXCN IMWTF
	GTTDE HTDHM KKCDK EAPHI AXZYP

Finding the initial position of the wheel

The initial position used to encrypt the message broken by Friedman is position 15. Indeed, for position 15, the IC has the maximum value: 0.072

$ python3 friedman_start.py -c MSGS/2h.cry
Wheel: [7, 6, 7, 5, 6, 7, 6, 8, 6, 10, 5, 6, 5, 7, 6, 5, 9]  Sector:  0

  1: 0.044623
  2: 0.044816
  3: 0.041382
  4: 0.043224
  5: 0.044861
  6: 0.044486
  7: 0.045111
  8: 0.046472
  9: 0.042932
 10: 0.042309
 11: 0.043740
 12: 0.043981
 13: 0.044094
 14: 0.043531
 15: 0.072096
 16: 0.045254
 17: 0.043501

Find the rest of the key (the core of the method)

By applying the method described earlier, I was able to reconstruct the following alphabet:

	XYWDBCAEHGFNJKPMIOL.TSR.VZ
There are missing letters (there may even be some uncertain letters). I complete the alphabet randomly (I can also try both possibilities):
	XYWDBCAEHGFNJKPMIOLQTSRUVZ
Then I use this alphabet to decipher the cryptogram. I get gibberish BUT with a IC (Index of Coincidence) of 0.070, so we have a simple substitution!

I'm using Hill Climbing method to solve this simple substitution, and I was able to reconstruct the plain text:

	THECOURTISUNABLETHEREFORETOPERCEIVETHEPRESENCEINTH...

There may be some errors (if I had incorrectly completed the alphabet), but it is easy to find the plaintext and then the complete key.

Details of the operations:

$ python3 friedman_end.py -c MSGS/2h.cry -w 6,5,9,7,6,7,5,6,7,6,8,6,10,5,6,5,7
    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
 0: 1  1  4  3  1  0  0  2  0  1  1  1  6  1  2  0  0  0  4  0  0  1  0  7  7  3
 1: 2  3  2  1  6  0  0  0  2  0  0  0  2  0  1  5  0  0  0  5  0  1  6  3  0  5
 2: 2  0  2  3  0  1  0  1  0  0  4  0  4  0  0  2  5  1  0  0  1  6  0  0  6  6
 3: 0  1  2  1  1  0  0  1  1  7  0  4  2  0  0  2  1  1  2  0  2  6  4  4  0  0
 4: 0  1  0  2  0  0  0  0  0  3  3  0  0  5  4  1  0  2  5  0  6  0  2  0  8  0
 5: 2  1  0  4  0  4  0  0  0  4  2  0  0  1  0  0  1  4  6  0  0  5  3  5  1  0
 6: 0  2  0  0  0  0  1  0  1  0  0  2  7  4  0  1  2  0  3 13  3  0  3  1  1  2
 7: 2  0  0  0  0  5  4  1  0  1  0  1  0  3  0  3  1  3  0  8  0  6  0  4  2  1
 8: 0  0  0  1  3  2  3  6  1  1  1  3  0  1  2  0  7  1  3  1  1  1  1  1  0  3
 9: 4  0  0  2  0  0  3  0  3  6  0  3  1  3  7  0  0  5  0  0  0  3  0  0  0  3
10: 1  0  2  0  4  0  0  2  1  0  0  0  2  4  6  3  5  0  1  1  2  5  1  0  3  0
11: 2  2  3  0  4  2  3  1  4  0  1  2  2  0  0  1  1  2  1  4  5  0  0  2  0  1
12: 4  1  0  2  1  0  4  0  0  2  3  0  5  0  4  5  1  2  4  0  0  0  0  2  2  1
13: 0  2  2  3  0  0  0  3  6  1  4  6  0  2  0  6  0  1  2  1  0  2  4  0  0  0
14: 0  0  0  4  4  3  0  0  0  5  6  1  1  2  7  0  1  1  0  6  0  1  0  0  4  0
15: 3  0  0  4  0  2  1  0  1  4  0  2  1  2  1  2  2  1  0  0  2  0  4  8  1  1
16: 0  0  4  2  0  4  0  1  1  0  3  3  7  6  2  0  0  0  1  1  1  0  1  2  0  4
17: 0  0  0  0  1  8  7  4  1  3  1  0  0  0  2  5  3  0  0  1  0  2  0  3  1  1
18: 3  0  0  4  3  0  6  5  5  0  5  0  2  2  0  0  2  0  0  0  1  0  0  3  0  2
19: 2  0  1  0  9  4  1  4  0  4  0  2  4  0  1  0  1  3  0  3  0  1  3  0  1  0
20: 5  0  5  0  4  1  3  0  1  2  2  0  0  2  0  7  0  1  3  0  3  0  0  0  5  1
21: 6  1 10  0  0  4  0  3  2  1  3  1  1  1  1  0  0  3  2  1  1  0  0  3  0  1
22: 0  5  7  2  4  1  1  0  1  4  0  0  4  2  1  1  1  3  2  1  0  1  0  1  0  0
23: 3  5  0  2  0  4  0  8  1  1  1  6  2  1  0  0  2  1  0  1  0  2  2  0  1  0
24: 1  0  3  3  2  5  6  0  0  1  0  0  0  0  0  1  2  1  1  0  5  0  6  3  3  0
25: 7  1  0  0  1  0  3  3  6  1  1  2  0  2  3  0  0  2  0  0  0  0  3  1  5  3

 A: 1  2  2  0  0  2  0  2  0  4  1  2  4  0  0  3  0  0  3  2  5  6  0  3  1  7 : 50
 B: 1  3  0  1  1  1  2  0  0  0  0  2  1  2  0  0  0  0  0  0  0  1  5  5  0  1 : 26
 C: 4  2  2  2  0  0  0  0  0  0  2  3  0  2  0  0  4  0  0  1  5 10  7  0  3  0 : 47
 D: 3  1  3  1  2  4  0  0  1  2  0  0  2  3  4  4  2  0  4  0  0  0  2  2  3  0 : 43
 E: 1  6  0  1  0  0  0  0  3  0  4  4  1  0  4  0  0  1  3  9  4  0  4  0  2  1 : 48
 F: 0  0  1  0  0  4  0  5  2  0  0  2  0  0  3  2  4  8  0  4  1  4  1  4  5  0 : 50
 G: 0  0  0  0  0  0  1  4  3  3  0  3  4  0  0  1  0  7  6  1  3  0  1  0  6  3 : 46
 H: 2  0  1  1  0  0  0  1  6  0  2  1  0  3  0  0  1  4  5  4  0  3  0  8  0  3 : 45
 I: 0  2  0  1  0  0  1  0  1  3  1  4  0  6  0  1  1  1  5  0  1  2  1  1  0  6 : 38
 J: 1  0  0  7  3  4  0  1  1  6  0  0  2  1  5  4  0  3  0  4  2  1  4  1  1  1 : 52
 K: 1  0  4  0  3  2  0  0  1  0  0  1  3  4  6  0  3  1  5  0  2  3  0  1  0  1 : 41
 L: 1  0  0  4  0  0  2  1  3  3  0  2  0  6  1  2  3  0  0  2  0  1  0  6  0  2 : 39
 M: 6  2  4  2  0  0  7  0  0  1  2  2  5  0  1  1  7  0  2  4  0  1  4  2  0  0 : 53
 N: 1  0  0  0  5  1  4  3  1  3  4  0  0  2  2  2  6  0  2  0  2  1  2  1  0  2 : 44
 O: 2  1  0  0  4  0  0  0  2  7  6  0  4  0  7  1  2  2  0  1  0  1  1  0  0  3 : 44
 P: 0  5  2  2  1  0  1  3  0  0  3  1  5  6  0  2  0  5  0  0  7  0  1  0  1  0 : 45
 Q: 0  0  5  1  0  1  2  1  7  0  5  1  1  0  1  2  0  3  2  1  0  0  1  2  2  0 : 38
 R: 0  0  1  1  2  4  0  3  1  5  0  2  2  1  1  1  0  0  0  3  1  3  3  1  1  2 : 38
 S: 4  0  0  2  5  6  3  0  3  0  1  1  4  2  0  0  1  0  0  0  3  2  2  0  1  0 : 40
 T: 0  5  0  0  0  0 13  8  1  0  1  4  0  1  6  0  1  1  0  3  0  1  1  1  0  0 : 47
 U: 0  0  1  2  6  0  3  0  1  0  2  5  0  0  0  2  1  0  1  0  3  1  0  0  5  0 : 33
 V: 1  1  6  6  0  5  0  6  1  3  5  0  0  2  1  0  0  2  0  1  0  0  1  2  0  0 : 43
 W: 0  6  0  4  2  3  3  0  1  0  1  0  0  4  0  4  1  0  0  3  0  0  0  2  6  3 : 43
 X: 7  3  0  4  0  5  1  4  1  0  0  2  2  0  0  8  2  3  3  0  0  3  1  0  3  1 : 53
 Y: 7  0  6  0  8  1  1  2  0  0  3  0  2  0  4  1  0  1  0  1  5  0  0  1  3  5 : 51
 Z: 3  5  6  0  0  0  2  1  3  3  0  1  1  0  0  1  4  1  2  0  1  1  0  0  0  3 : 38

23
[[23, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], 
[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], 
[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]
[[23, 0], [12, 11], [9, 14], [24, 25], [5, 16], [0, 20], [4, 19], [19, 6], [2, 21], 
[6, 17], [15, 12], [7, 18], [14, 9], [13, 15], [22, 24], [21, 2], [3, 23], [10, 13], 
[18, 5], [11, 8], [25, 1], [17, 4], [16, 19], [8, 10], [20, 15], [1, 22]]

X:  7  3  0  4  0  5  1  4  1  0  0  2  2  0  0  8  2  3  3  0  0  3  1  0  3  1 , 0
M:  2  5  0  1  1  7  0  2  4  0  1  4  2  0  0  6  2  4  2  0  0  7  0  0  1  2 ,11
J:  5  4  0  3  0  4  2  1  4  1  1  1  1  0  0  7  3  4  0  1  1  6  0  0  2  1 ,14
Y:  5  7  0  6  0  8  1  1  2  0  0  3  0  2  0  4  1  0  1  0  1  5  0  0  1  3 ,25
F:  4  8  0  4  1  4  1  4  5  0  0  0  1  0  0  4  0  5  2  0  0  2  0  0  3  2 ,16
A:  5  6  0  3  1  7  1  2  2  0  0  2  0  2  0  4  1  2  4  0  0  3  0  0  3  2 ,20
E:  9  4  0  4  0  2  1  1  6  0  1  0  0  0  0  3  0  4  4  1  0  4  0  0  1  3 ,19
T: 13  8  1  0  1  4  0  1  6  0  1  1  0  3  0  1  1  1  0  0  0  5  0  0  0  0 , 6
C: 10  7  0  3  0  4  2  2  2  0  0  0  0  0  0  2  3  0  2  0  0  4  0  0  1  5 ,21
G:  7  6  1  3  0  1  0  6  3  0  0  0  0  0  0  1  4  3  3  0  3  4  0  0  1  0 ,17
P:  5  6  0  2  0  5  0  0  7  0  1  0  1  0  0  5  2  2  1  0  1  3  0  0  3  1 ,12
H:  5  4  0  3  0  8  0  3  2  0  1  1  0  0  0  1  6  0  2  1  0  3  0  0  1  4 ,18
O:  7  6  0  4  0  7  1  2  2  0  1  0  1  1  0  0  3  2  1  0  0  4  0  0  0  2 , 9
N:  2  6  0  2  0  2  1  2  1  0  2  1  0  0  0  5  1  4  3  1  3  4  0  0  2  2 ,15
W:  6  3  0  6  0  4  2  3  3  0  1  0  1  0  0  4  0  4  1  0  0  3  0  0  0  2 ,24
V:  6  6  0  5  0  6  1  3  5  0  0  2  1  0  0  2  0  1  0  0  1  2  0  0  1  1 , 2
D:  2  3  0  3  1  3  1  2  4  0  0  1  2  0  0  2  3  4  4  2  0  4  0  0  0  2 ,23
K:  4  6  0  3  1  5  0  2  3  0  1  0  1  1  0  4  0  3  2  0  0  1  0  0  1  3 ,13
S:  6  3  0  3  0  1  1  4  2  0  0  1  0  0  0  3  2  2  0  1  0  4  0  0  2  5 , 5
L:  3  3  0  2  0  6  1  2  3  0  0  2  0  1  0  6  0  2  1  0  0  4  0  0  2  1 , 8
Z:  5  6  0  0  0  2  1  3  3  0  1  1  0  0  1  4  1  2  0  1  1  0  0  0  3  3 , 1
R:  2  4  0  3  1  5  0  2  2  1  1  1  0  0  0  3  1  3  3  1  1  2  0  0  1  1 , 4
Q:  1  0  0  1  2  2  0  0  0  5  1  0  1  2  1  7  0  5  1  1  0  1  2  0  3  2 ,19
I:  1  4  0  6  0  1  1  1  5  0  1  2  1  1  0  6  0  2  0  1  0  0  1  0  1  3 ,10
U:  2  1  0  1  0  3  1  0  0  5  0  0  0  1  2  6  0  3  0  1  0  2  5  0  0  0 ,15
B:  5  5  0  1  1  3  0  1  1  1  2  0  0  0  0  2  1  2  0  0  0  0  0  0  0  1 ,22
Interior Alphabet:  XYWDBCAEHGFNJKPMIOL.TSR.VZ , Collision:  True
$
$ python3 hc_substi.py -c /tmp/dechi.txt -t 3
(0, 8714.78289227325, 'THECOURTISUNABLETHEREFORETOPERCEIVETHEPRESENCEINTH')
(1, 8714.78289227325, 'THECOURTISUNABLETHEREFORETOPERCEIVETHEPRESENCEINTH')
(2, 7918.753720823474, 'EANHSLOERDLITBUNEANONCSONESYNOHNRKNEANYONDNIHNRIEA')
()
('Key: ', 'DEZYBQGHFXCLKIPMJRVASTUWNO', ' Score: ', 8714.78289227325)
THECOURTISUNABLETHEREFORETOPERCEIVETHEPRESENCEINTHEINSTANTCASEOFANYCIRCUMSTANC...

The Friedman's solution: it was (in part) incorrect!

Friedman and his team did indeed find the plain text for the cryptogram (THECOURT...). However, the proposed key (given by K&R and Callimahos) is incorrect!

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

I'm exaggerating a bit. Actually, the alphabets found are reversed. Instead of having (for the outer alphabet) JNFG...MPK, we have JKPM...GFN.

I think Friedman and his team's mistake stems from using a paper emulator of the Kryha machine and advancing the inner alphabet in the wrong direction!

The plain text

Here's the solution to the problem with the alphabets I found, but with the same alignment used by Friedman.

The key:

  • Starting sector: 15
  • Interior Alphabet: JKPMIOLQTSRUVZXYWDBCAEHGFN
  • Exterior Alphabet: PYZOFRUVWSXQDCTEKABIGHNJML
$ python3 kryha_tui.py -o -f15 -i JKPMIOLQTSRUVZXYWDBCAEHGFN \
-e PYZOFRUVWSXQDCTEKABIGHNJML -d < MSGS/2h.cry

THECOURTISUNABLETHEREFORETOPERCEIVETHEPRESENCEINTHEINSTANTCASEOFANYCIRC
UMSTANCEWHICHMIGHTDIFFERENTIATEITFROMTHECASESINVOLVINGTHEUSEOFTHERUSSIA
NSEALDECIDEDBYJUDGEANJGEWSINTHISSITUATIONTHECOURTISUNWILLINGTOREACHACON
CLYSIONDIAMETRICALLYOPPOSEDTOTHATARRIVEDATBYTHATABLEJURISTAFTERTHECAREF
ULANDPAINSTAKINGCONSIDERATIONOFTHELAWANDTHEFACTSWHICHHISLEARNEDOPINIONI
NDICATESHEGAVETOTHEACTIONSTRIEDBEFOREHIMTHECOURTACCORDINGLYHOLDSTHATTHE
REININSUFFICIENTPROOFINTHEPRESENTRECORDTOSUSTAINAFINDIZGTHATTHERUSSIANB
USINESSORTHATITSAGENTSWEXEEMPOWEREDTOAFFIXITTOPOLICIESSOASTOGIVETHEMTHE
OORCEANDEFFECTOFSEALEDINSTRUMENTSTHEFIRSTCAUSEOFACTIONISTHEREFOREBARRED
BYOURSIXYEARSTATUTEOFLIMITAFIONSANDITISAACORDINGLYUNNECESSARYTOCONSIDER
WHETHERTHERUSSIANSTATUTEOFLIMITATIONSOFTENYEARSCOMMENCEDTOHUNUPONTHEACC
RUALOFTHECAUSEOFACTIONASTHEDEFENDANTCONTENDSORUPONTHECOMMENCEMENTOFTHEA
CTIONASTHEPLAINTIFFARGUESITISLIKEWISEUNNECESSARYTODETERMINEWHETHERTHEUU
NNINGOFTHISSTATUTEWASSUSPENDEDBECAUSEOFTHECLOSINGOFTHERUSSIANCOURTSTOCO
NIROVERWIESARISINGOUTOFCIVILRELATIONSHIPORIGINATINGPRIORTOTHESOVIETREVO
LUTIONTHEMOTIONTODISMISSTHECOMPLAINTISGRANTEDASTOTHEFIRSTCAUSEOFACTION

Reference

Articles and Books

  • Machine Cryptography and Modern Cryptanalysis, By Cipher A. Deavours & Louis Kruh, (1985), Artech House Publishers.
    Note: This book describes how to decipher the message received by Friedman.

Internet References

  • NSA, Q. E. D. - 2 Hours, 41 Minutes, By LAMBROS D. CALLIMAHOS, Unclassified (link)
    Note: This article presents Callimahos's reconstruction of Friedman's method