CryptologyCommentary on Verne's Mathias Sandorf 

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 (15011576) 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 (like Karl May). »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.
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).
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.
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 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
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
HONGRI HONGRI LEVERZ LEVERO ALQUER ALQUEV
HONGRIE HONGRIE HONGRIE HONGRIE HONGRIE HONGRIE LEVERON LEVERON LEVEROI LEVEROS LEVEROT LEVEROO ALQUEVO ALQUEVU ALQUEVP ALQUEVI ALQUEVA ALQUEVR
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
First let us try VOUS; for the S we find three possible columns:
HONGRIEXU HONGRIEXR HONGRIEXD LEVERONTR LEVERONTE LEVERONTU ALQUEVOUS ALQUEVOUS ALQUEVOUS
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
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
LAHONGRIEX SELEVERONT GNALQUEVOU
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
UNLAHONGRIEX RNLAHONGRIEX DNLAHONGRIEX RESELEVERONT EESELEVERONT UESELEVERONT SIGNALQUEVOU SIGNALQUEVOU SIGNALQUEVOU UELAHONGRIEX RELAHONGRIEX DELAHONGRIEX RSSELEVERONT ESSELEVERONT USSELEVERONT SIGNALQUEVOU SIGNALQUEVOU SIGNALQUEVOU
DELAHONGRIEXU DELAHONGRIEXR USSELEVERONTR USSELEVERONTE SIGNALQUEVOUS SIGNALQUEVOUS
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
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
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
ENDANCEDELAHONGRIEXU ENDANCEDELAHONGRIEXR IESTETOUSSELEVERONTR IESTETOUSSELEVERONTE PREMIERSIGNALQUEVOUS PREMIERSIGNALQUEVOUS
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
INDEPENDANCEDELAHONGRIEXU INDEPENDANCEDELAHONGRIEXR ZDETRIESTETOUSSELEVERONTR ZDETRIESTETOUSSELEVERONTE RETAUPREMIERSIGNALQUEVOUS RETAUPREMIERSIGNALQUEVOUS
The next one that makes some sense yields:
LINDEPENDANCEDELAHONGRIEXU LINDEPENDANCEDELAHONGRIEXR EZDETRIESTETOUSSELEVERONTR EZDETRIESTETOUSSELEVERONTE PRETAUPREMIERSIGNALQUEVOUS PRETAUPREMIERSIGNALQUEVOUS
RLINDEPENDANCEDELAHONGRIEXU RLINDEPENDANCEDELAHONGRIEXR REZDETRIESTETOUSSELEVERONTR REZDETRIESTETOUSSELEVERONTE TPRETAUPREMIERSIGNALQUEVOUS TPRETAUPREMIERSIGNALQUEVOUS
URLINDEPENDANCEDELAHONGRIEXR RREZDETRIESTETOUSSELEVERONTE STPRETAUPREMIERSIGNALQUEVOUS
But the X, what about the X?
Well then, let's continue at the left end:
SSEPOURLINDEPENDANCEDELAHONGRIEXR SENVERREZDETRIESTETOUSSELEVERONTE TOUTESTPRETAUPREMIERSIGNALQUEVOUS
Three columns remain:
HAZ AMN UON
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.
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.
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.