[JoGu]

Cryptology

Commentary on Verne's Mathias Sandorf

a7Hzq .#5r<
kÜ\as TâÆK$
ûj(Ö2 ñw%h:
Úk{4R f~`z8
¤˜Æ+Ô „&¢Dø

Introduction

The episode from the novel Mathias Sandorf that contains the cryptogram is written in a tense style and shows that Jules Verne knew the actual state of cryptography. The austrian Oberst (Colonel) Eduard Fleißner von Wostrowitz in 1881 published his Handbuch der Kryptographie (Handbook of Cryptography) that describes the turning grille. (There is a mention of this handbook in Hašek's novel »Švejk«.) However turning grilles were in use already in 18th century (see F. L. Bauer); Cardano (1501-1576) is credited as inventor.

As usually Jules Verne doesn't care much about plausibility or scientific correctness. Why these enormous efforts for transmitting 1 bit of information: »We are ready«! How does Sandorf complete the journey from Trieste to Transylvania in three days? Should we believe that hungarian conspirators translate their messages into French before encrypting them? Of course the cryptanalysis of a hungarian ciphertext would be difficult to follow for french readers. Apart from that, Sarcany and Toronthal would fail with this task because lacking knowledge of Hungarian.

Verne also had bad luck in choosing foreign names. »Sandor« would look a lot more Hungarian than »Sandorf«.
Verne keeps quiet about how simple the construction of a turning grille is for those who know the trick. Instead he calls the adjustments of the holes as »ingeniously masterminded«.

Also Jules Verne errs when he asserts that the turning grille is unbreakable. In reality it is relatively easily solved by multiple anagramming. We demonstrate this in the following.


The Cryptogram

What Sarcany copied from the note was the ciphertext

IHNALZ ARNURO ODXHNP AEEEIL SPESDR EEDGNC
ZAEMEN TRVREE ESTLEV ENNIOS ERSSUR TOEEDT
RUIOPN MTQSSL EEUART NOUPVG OUITSE ERTUEE

The coincidence index = 0.080 hints at a transposition, the language could be a roman one because these usually have quite large coincidence indices about 0.08 (french 0.0778, italian 0.738, spanish 0.0775, portuguese 0.0791).


Letter Frequencies

We get further clarity by counting the 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
5  0  1  4 22  0  2  2  5  0  0  4  2  9  7  4  1 10  9  8  7  3  0  1  0  2

The outstanding frequency of E compared with the other vocals speaks in favor of French. Also the entire distribution convincingly fits the French language. Hungarian is excluded as plaintext source.

The arrangement of the ciphertext suggests a transposition with a 6x6 grille, as Sarcany believed too.

Therefore a good working hypothesis is: The cryptogramm results from encrypting a french plaintext using a grille.


Entering the Analysis

The third row contains a Q in position 9. The following letter should be U with high probality — even if not 100% in French. The last line of the cryptogram contains five U's.

Because the three rows of the cryptogram are results of the same permutation we get the following five options for the two adjacent columns:

NH  NX  NE  NP  NG
VA  VT  VN  VR  VE
QU  QU  QU  QU  QU
The last of them looks best, therefore we try this first.

The QU most probably is followed by E or I. This gives eight possibilities:

NGN  NGO  NGD  NGE  NGR  NGE  NGN  NGC
VEE  VEE  VES  VES  VER  VET  VED  VET
QUI  QUE  QUE  QUI  QUE  QUE  QUE  QUE
Here the columns 4, 5, and 6 look promising.


A Probable Word

The context of the cryptogram suggests the probable word »Hungary«, in french »HONGRIE«, maybe after detecting the triple NGR in column 5 ...

Let's cheerfully try it! The first row of the cryptogram contains exactly two H's and two O's. We get four possible arrangements:

HONGR  HONGR  HONGR  HONGR
AEVER  AEVER  LEVER  LEVER
ULQUE  UEQUE  ALQUE  AEQUE
We like arrangement 3 most and try to continue it by one of the two I's:.

HONGRI  HONGRI
LEVERZ  LEVERO
ALQUER  ALQUEV
The second possibility seems slightly more plausible. So we continue by appending an E, getting six variants:
HONGRIE  HONGRIE  HONGRIE  HONGRIE  HONGRIE  HONGRIE
LEVERON  LEVERON  LEVEROI  LEVEROS  LEVEROT  LEVEROO
ALQUEVO  ALQUEVU  ALQUEVP  ALQUEVI  ALQUEVA  ALQUEVR
Of these the first two look best; we decide to follow both of them.


Another Probable Word Shines Through

If we assume that a revolt is mentioned in the text, we may speculate that the second row contains the probable term »se leveront«. By and by the lead gets hot, even if we bear in mind that anagrams are often misleading.

At first sight we see two times four choices for the T:

HONGRIEA  HONGRIEX  HONGRIEE  HONGRIEC
LEVERONT  LEVERONT  LEVERONT  LEVERONT
ALQUEVOM  ALQUEVOU  ALQUEVOE  ALQUEVOE

HONGRIEA  HONGRIEX  HONGRIEE  HONGRIEC
LEVERONT  LEVERONT  LEVERONT  LEVERONT
ALQUEVUM  ALQUEVUU  ALQUEVUE  ALQUEVUE
The second one in the upper row looks promising — there could be a VOUS. The X annoys us; however as sometimes practised it could be a padding. The last two options in the second row could also come into consideration.

First let us try VOUS; for the S we find three possible columns:

HONGRIEXU  HONGRIEXR  HONGRIEXD
LEVERONTR  LEVERONTE  LEVERONTU
ALQUEVOUS  ALQUEVOUS  ALQUEVOUS
None of these is completely convincing. For the moment we leave this point and try to complete the text ahead as SE LEVERONT.

Two of the ten E's in the second row are already absorbed, that leaves us with eight choices. Moreover there are four possible S's. That's a lot of work. First we try the eight E's:

NHONGRIEX  LHONGRIEX  RHONGRIEX  OHONGRIEX
ELEVERONT  ELEVERONT  ELEVERONT  ELEVERONT
IALQUEVOU  PALQUEVOU  SALQUEVOU  EALQUEVOU

NHONGRIEX  AHONGRIEX  SHONGRIEX  DHONGRIEX
ELEVERONT  ELEVERONT  ELEVERONT  ELEVERONT
RALQUEVOU  NALQUEVOU  OALQUEVOU  TALQUEVOU
The options 1, 3, 5, and 6 look most promising and will be followed first:
DNHONGRIEX  LNHONGRIEX  ENHONGRIEX  ENHONGRIEX
SELEVERONT  SELEVERONT  SELEVERONT  SELEVERONT
EIALQUEVOU  GIALQUEVOU  IIALQUEVOU  TIALQUEVOU

DRHONGRIEX  LRHONGRIEX  ERHONGRIEX  ERHONGRIEX
SELEVERONT  SELEVERONT  SELEVERONT  SELEVERONT
ESALQUEVOU  GSALQUEVOU  ISALQUEVOU  TSALQUEVOU

DNHONGRIEX  LNHONGRIEX  ENHONGRIEX  ENHONGRIEX
SELEVERONT  SELEVERONT  SELEVERONT  SELEVERONT
ERALQUEVOU  GRALQUEVOU  IRALQUEVOU  TRALQUEVOU

DAHONGRIEX  LAHONGRIEX  EAHONGRIEX  EAHONGRIEX
SELEVERONT  SELEVERONT  SELEVERONT  SELEVERONT
ENALQUEVOU  GNALQUEVOU  INALQUEVOU  TNALQUEVOU
In the upper group of four the last option looks not bad, in the second group all four options dissatisfy us, in the third group number four looks good, also the first one of the last group, but the second one electrifies us because we see LA HONGRIE. Therefore we follow this first. Isolated it looks:
LAHONGRIEX
SELEVERONT
GNALQUEVOU


Yet Another Probable Word

We search for possible continuations. Only the third row seems suitable for this purpose. Almost mandatory is the completion SIGNAL QUE VOUS.

The I yields two possibilities:

NLAHONGRIEX  ELAHONGRIEX
ESELEVERONT  SSELEVERONT
IGNALQUEVOU  IGNALQUEVOU
and the S three more for each case:
UNLAHONGRIEX  RNLAHONGRIEX  DNLAHONGRIEX
RESELEVERONT  EESELEVERONT  UESELEVERONT
SIGNALQUEVOU  SIGNALQUEVOU  SIGNALQUEVOU

UELAHONGRIEX  RELAHONGRIEX  DELAHONGRIEX
RSSELEVERONT  ESSELEVERONT  USSELEVERONT
SIGNALQUEVOU  SIGNALQUEVOU  SIGNALQUEVOU
Options 1, 2, 5, and 6 should be considered further, however number 6 stands out because of the sequence DE LA HONGRIE. Let us take this first, and try to append the two remaining S's:
DELAHONGRIEXU  DELAHONGRIEXR
USSELEVERONTR  USSELEVERONTE
SIGNALQUEVOUS  SIGNALQUEVOUS
Both choices seem possible although the X becomes more and more irritating. However, appealing to our phantasy, we come across the term TOUS SE LEVERONT — »all stand up« — that fits into the context of a revolution.


Completing the Probable Term

Let us try our guess. We have one O and three T's at our disposal:

AEDELAHONGRIEXU  EEDELAHONGRIEXU  CEDELAHONGRIEXU
TOUSSELEVERONTR  TOUSSELEVERONTR  TOUSSELEVERONTR
MRSIGNALQUEVOUS  ARSIGNALQUEVOUS  ERSIGNALQUEVOUS

AEDELAHONGRIEXR  EEDELAHONGRIEXR  CEDELAHONGRIEXR
TOUSSELEVERONTE  TOUSSELEVERONTE  TOUSSELEVERONTE
MRSIGNALQUEVOUS  ARSIGNALQUEVOUS  ERSIGNALQUEVOUS
The two options to the right look best, however the two middle ones should also be considered. We continue with the two right ones.


A New Idea

Which of the original columns are left over? These ones:

IHNALZ AR(UR) ODNP EE SPS EDN
ZAEMEN TR(RE) ESEV NI ERS TED
RUIOPN MT(SS) EERT UP OUT ATE
The two columns in parentheses stand for the somewhat problematic tentative last column of the deciphered text.

When we discard the used columns we observe that the first nine of them were picked up in order from right to left. Then the procedure restarted at the right and again proceeded to the left for the next six columns.

Could there be a system behind this observation? Then we would try next the columns at the left end. The first that fits is the third. For the two options under current consideration this yields:

NCEDELAHONGRIEXU  NCEDELAHONGRIEXR
ETOUSSELEVERONTR  ETOUSSELEVERONTE
IERSIGNALQUEVOUS  IERSIGNALQUEVOUS
Could this be PREMIER SIGNAL? Would this be consistent with the assumption that for the columns at the left side we have to choose from the unused columns at the left? Yes!
ENDANCEDELAHONGRIEXU  ENDANCEDELAHONGRIEXR
IESTETOUSSELEVERONTR  IESTETOUSSELEVERONTE
PREMIERSIGNALQUEVOUS  PREMIERSIGNALQUEVOUS
We skipped an E that didn't fit in row 1.


Further Guesses

Further associations come to our minds: TRIESTE and (IN)DEPENDANCE. They fit collectively:

DEPENDANCEDELAHONGRIEXU  DEPENDANCEDELAHONGRIEXR
ETRIESTETOUSSELEVERONTR  ETRIESTETOUSSELEVERONTE
TAUPREMIERSIGNALQUEVOUS  TAUPREMIERSIGNALQUEVOUS

Up to now we toke eight columns from the left. To the right of these there is one more, so we take this one — it fits:

NDEPENDANCEDELAHONGRIEXU  NDEPENDANCEDELAHONGRIEXR
DETRIESTETOUSSELEVERONTR  DETRIESTETOUSSELEVERONTE
ETAUPREMIERSIGNALQUEVOUS  ETAUPREMIERSIGNALQUEVOUS

Now we restart at the left. The remaining columns are:

IHALZ R(UR) OP E SS
ZAMEN R(RE) EV N ES
RUOPN T(SS) ET U OT
The first one yields INDEPENDANCE:
INDEPENDANCEDELAHONGRIEXU  INDEPENDANCEDELAHONGRIEXR
ZDETRIESTETOUSSELEVERONTR  ZDETRIESTETOUSSELEVERONTE
RETAUPREMIERSIGNALQUEVOUS  RETAUPREMIERSIGNALQUEVOUS

The next one that makes some sense yields:

LINDEPENDANCEDELAHONGRIEXU  LINDEPENDANCEDELAHONGRIEXR
EZDETRIESTETOUSSELEVERONTR  EZDETRIESTETOUSSELEVERONTE
PRETAUPREMIERSIGNALQUEVOUS  PRETAUPREMIERSIGNALQUEVOUS
Then we find:
RLINDEPENDANCEDELAHONGRIEXU  RLINDEPENDANCEDELAHONGRIEXR
REZDETRIESTETOUSSELEVERONTR  REZDETRIESTETOUSSELEVERONTE
TPRETAUPREMIERSIGNALQUEVOUS  TPRETAUPREMIERSIGNALQUEVOUS
From this point on there remain only six columns. Of the two columns in parentheses the first one fits at the left end, the second one remains for the right end:
URLINDEPENDANCEDELAHONGRIEXR
RREZDETRIESTETOUSSELEVERONTE
STPRETAUPREMIERSIGNALQUEVOUS

But the X, what about the X?


The Remaining Columns

Well then, let's continue at the left end:

SSEPOURLINDEPENDANCEDELAHONGRIEXR
SENVERREZDETRIESTETOUSSELEVERONTE
TOUTESTPRETAUPREMIERSIGNALQUEVOUS

Three columns remain:

HAZ
AMN
UON
At the left end they make no sense. But they fit at the right end, picking them vom right to left:
SSEPOURLINDEPENDANCEDELAHONGRIEXRZAH
SENVERREZDETRIESTETOUSSELEVERONTENMA
TOUTESTPRETAUPREMIERSIGNALQUEVOUSNOU

Staring long enough at this we realise that the rows must be taken from bottom to top. And the end of the text is the mysterious sequence XRZAH — maybe random padding or, as Toronthal suspected, a pseudonym of the sender of the message.


The Solution

This is the plaintext:

TOUTESTPR ETAUPREMI ERSIGNALQ UEVOUSNOU
SENVERREZ DETRIESTE TOUSSELEV ERONTENMA
SSEPOURLI NDEPENDAN CEDELAHON GRIEXRZAH

By the way the complete solution allows the reconstruction of the grille.


Discussion

Here are the main ingredients of our solution:

This last remark touches on an essential point of cryptanalysis: Often the observations of the cryptanalyst don't lead to imperative conclusions but only to different weighting of the probabilities of the possible next steps. Then it makes sense to follow the most plausible option first. If this fails, the cryptanalyst has to go back and follow the second best path. In this way he traverses the decision tree with best success on average.


Author: Klaus Pommerening, 2000-Apr-06; last change: 2021-Jan-14.