Encrypted Messages: Mathematical Games in Literature
#Pure tech
12.04.2024 Reading time: 7 minutes
Marta Macho Stadler
Ilustration: Laura Arrue
Mathematics is highly present in our daily lives. In the technological field, among other uses, it underpins the cryptographic codes that many digital tools rely on. Literature also hasn’t forgotten mathematics. Shall we combine cryptography and literature?
PLAYING AND CODING: GETTING STARTED
Today, cryptography is taught in many undergraduate and graduate university programs. Courses that include this discipline, study theoretical tools that enable information to be transmitted reliably and securely.
Encrypted messages are used in diverse fields such as espionage or commercial transactions. They also present an extraordinary intellectual challenge for anyone who wants to "play" with them. Literature contains wonderful examples of coded messages that structure the plots of certain stories. Here are two examples.
THE ADVENTURE OF THE DANCING MEN: A CRYPTOGRAM IN A MYSTERY STORY
Sherlock Holmes, the famous detective created by Arthur Conan Doyle (1859–1930), was known for his great deductive skills. He had a "mathematical mind." In his short story The Adventure of the Dancing Men, the detective also uses his cryptographic skills.
In this story, Hilton Cubitt seeks Holmes’ help to unravel a mystery involving his wife: Elsie is distressed after receiving strange messages. These contain no words, only stick figures with arms and legs positioned in various ways, some carrying flags and, at times, even turned upside down. Holmes explains:
These hieroglyphics have evidently a meaning. If it is a purely arbitrary one it may be impossible for us to solve it. If, on the other hand, it is systematic, I have no doubt that we shall get to the bottom of it.
Holmes begins his investigation by studying the frequency of each symbol (each stick figure) in the messages Elsie receives and compares it with the frequency of letter usage in English.
Having once recognised, however, that the symbols stood for letters, and having applied the rules which guide us in all forms of secret writings, the solution was easy enough.
The detective starts by identifying the most repeated symbol, which must correspond to the letter E, the most common letter in English texts. Guided by context, grammar, and common sense, Holmes decodes the hidden meaning of the cryptograms.
In fact, this "alphabet" of "dancing men" was an invention of Patrick, Elsie's father and leader of a gang of criminals. This way of writing allowed him to send warnings to his gang. Because they looked like a silly game, these messages went unnoticed by anyone who didn’t know the key.
Despite uncovering the code, Holmes fails to prevent the murder of his client, Hilton Cubitt, although he does unmask the killer. Already familiar with the hidden code, he sends a message in the "dancing men" alphabet, pretending it comes from Elsie…
THE GIANT RAFT: A CRYPTOGRAM IN AN ADVENTURE NOVEL
The Giant Raft. Eight Hundred Leagues on the Amazon is an adventure and suspense novel by Jules Verne (1828–1905).
The story takes place in 1852. Joam Garral, a man of Brazilian origin, owns a prosperous estate in Iquitos (Peru). He is the father of Benito and Minha. His daughter is about to marry Benito's best friend, Manuel Valdez, in Belém (Brazil). Garral decides to transport the family entourage and servants aboard a large raft heading for the Atlantic coast of Brazil, down the Amazon River. They must travel eight hundred leagues along the river to celebrate the wedding.
But Garral has a secret: he is a fugitive from Brazilian justice. Years ago, he was falsely accused of theft and murder. He had to flee Brazil to avoid an unjust punishment: a death sentence for a crime he didn‘t commit. Upon reaching Manaus, Torres, a sinister character, blackmails Garral, demanding that he marry Minha in exchange for his silence. Garral refuses to submit, is arrested, and sentenced to death.
However, Torres possesses a coded document with the confession of the real murderer. This manuscript uses the so-called "Gronsfeld cipher," which is more complex than the code Conan Doyle uses in The Adventure of the Dancing Men. While Doyle’s story uses a substitution cipher where each character in the original text is replaced by another in the coded text, the cipher in The Giant Raft is polyalphabetic: each symbol does not always correspond to the same character. Moreover, it uses a numerical key to encode and decode. Here’s an example. Let's first fix an original 26-letter alphabet:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Let’s suppose the message we want to send is:
BIZKAIATECH MAGAZINE
With the key 12345, the encrypted message would be:
CKCOFJCWIHI ODKFAKQI
How is this obtained? The key (one digit per letter) is placed under the text to be encrypted and repeated as many times as necessary. The encrypted message is produced by replacing each original letter with the letter located (to the right in the fixed alphabet) by as many positions as indicated by the digit below that letter:
B I Z K A I A T E C H M A G A Z I N E
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4
C K C O F J C W I H I O D K F A K Q I
As you can see in the chart, B+1=C, I+2=K, Z+3=C and so on. To decrypt the message, simply reverse the process: in the coded message, each letter is replaced by the one located (to the left in the alphabet) by as many positions as the digit below that letter: C - 1 = B, K - 2 = I, C - 3 = Z, etc.
The Giant Raft begins with a coded message—the final paragraph of a hundred-line encrypted text (not included in the novel) hiding the confession of a man named Ortega, the true culprit of the crime for which Garral was accused.
P h y j s l y d d q f d z x g a s g z z q q e h x g k f n d r x u j u g i o c y t d x v k s b x h h u y p o h d v y r y m h u h p u y d k j o x p h e t o z s l e t n p m v f f o v p d p a j x h y y n o j y g g a y m e q y n f u q l n m v l y f g s u z m q i z t l b q g y u g s q e u b v n r c r e d g r u zb l r m x y u h q h p z d r r g c r o he p q x u f i v v r p l p h o n t h v d d q f h q s n t z h h h n f e p m q k y u u e x k t o g z g k y u u m f v i j d q d p z j q s y k r p l x h x q r y m v k l o h h h o t oz v d k s p p s u v j h d.
When Garral is arrested in Manaus, Judge Jarríquez, responsible for his defense, tries to decode the message using various methods. His efforts are unsuccessful. Almost at the last moment, the name "Ortega" is suggested as the possible signatory of the encrypted message. Thanks to this discovery, the judge finds the key and uses the Gronsfeld method (although he does not name it, only describes it) to decipher the hidden message:
The real author of the robbery of the diamonds and of the murder of the soldiers who escorted the convoy, committed during the night of the twenty- second of January, one thousand eight hundred and twenty-six, was thus not Joam Dacosta, unjustly condemned to death; it was I, the wretched servant of the Administration of the diamond district; yes, I alone, who sign this with my true name, Ortega.
Thanks to this revelation, Garral (whose real surname was Dacosta) escapes the gallows, and the story ends happily.
USING TECHNOLOGY TO ENCODE AND DECODE
There are many online sites that help encode and decode messages using different encryption systems. My favorite is the website DCode.fr, where I’ve tested the Gronsfeld method with different alphabets and keys. However, it’s always more fun to do it manually, as long as the message to be encoded isn’t too long…
Labels
- #cultura
- #ciencia
- #educación
- #mujeres
Take our advice and check it out
Slide to show more
Cookies
We use proprietary and third-party cookies for technical, analytical and customisation purposes, such as choosing the language in which to display the website. For more information, please consult our cookies policy (Opens modal window).
Cookies policy
The website at https://www.bizkaia.eus (hereinafter, the Website) uses tools to track browsing activity on the website and the IP address of the service recipient for the purpose of improving and guaranteeing the provision of services or technical operation of the website, distinguishing you from other users and analysing your browsing habits.
This Cookies Policy seeks to inform you clearly and precisely about the operation and function of the cookies we use.
What are cookies and why do we use them?
A cookie is a file that is downloaded to your computer when accessing certain websites.
Cookies enable a website to, among other things, store and recover information about the browsing habits of a user or their device and, depending on the information contained and the way in which the same is used by the device, may be used to recognise the user.
Current law allows us to store cookies on your device if they are strictly necessary for operation of this website. However, we need permission for all other cookies.
Types of cookies based on the managing entity
Depending on who manages the computer or domain from where the cookies are sent and who processes the data obtained, a distinction can be made between the following types of cookies:
- Proprietary cookies: these are managed by the Provincial Council of Biscay.
-
Third-party cookies: these are managed by another entity, which processes the data obtained via the cookies.
This website may contain cookies belonging to the Basque Government, used for its own purposes and stored by domains other than those owned by the Bizkaia Provincial Council.
Types of cookies based on their purpose
- Technical cookies: these allow the user to browse a website, platform or application and to use the various options or services available, such as control data traffic and communication, identify the session, access restricted areas, request registration or participation in an event, use security elements while browsing, store content for video or audio playback, or share content via social media networks.
- Customisation cookies: these allow the user to access the service with some general characteristics predefined according to a series of criteria on the user’s device, such as the language, type of browser being used to access the service, regional configuration from where the service is accessed, etc.
- Analysis cookies: these allow the number of users to be counted and the browsing activity to be statistically measured and analysed for the purpose of improving the services made available. They may be proprietary or third-party cookies.
Duration of the cookies
- Session cookies: these collect and store data while the user is visiting a website.
- Persistent cookies: the data are stored on the device in an ongoing fashion and may be accessed and processed during a period defined by the cookie manager, which may range from a few minutes to several years.
Which cookies does this website use?
In each row you can find data relating to Technical cookies
| Name | Purpose | Duration | Owner |
|---|---|---|---|
| JSESSIONID | Session identifier | Session | Bizkaia Provincial Council |
| ASPSESSIONID | Session identifier | Session | Bizkaia Provincial Council |
| TS01 | Session identifier | Session | Bizkaia Provincial Council |
| LFR_SESSION_STATE | Session identifier | Session | Bizkaia Provincial Council |
| COOKIE_SUPPORT | Indicate whether the user has the cookie support activated | 1 year | Bizkaia Provincial Council |
| pc_tecnicas_bizkaia | Choose your preferences for acceptance of the block of technical cookies | 1 year | Bizkaia Provincial Council |
| pc_analitica_bizkaia | Choose your preferences for acceptance of the block of analytical cookies | 1 year | Bizkaia Provincial Council |
| pc_preferencias_bizkaia | Choose your preferences for acceptance/rejection of the block of preferential cookies | 1 year | Bizkaia Provincial Council |
| pc_terceros_bizkaia | Choose your preferences for acceptance/rejection of the block of third-party cookies | 1 year | Bizkaia Provincial Council |
| Kultursistema_session | Keeping the user’s session | 1 year | Kultursistema |
| CPLB | Contains information used by our load-balancing servers | Session | Provincial Council of Biscay |
| XSRF-TOKEN | To prevent CSRF (Cross-Site Request Forgery) attacks | 1 year | Kultursistema |
| _GRECAPTCHA | Protects the website from spam and brute-force attacks | 5 months |
In each row you can find data relating to Analysis cookies
| Name | Purpose | Duration | Owner | |
|---|---|---|---|---|
| dtCookie | Track a visit through multiple requests | Session | Bizkaia Provincial Council | |
| dtLatC | Measure the latency of the server to monitor performance | Session | Bizkaia Provincial Council | |
| dtPC | Necessary to identify the appropriate parameters for beacon transmission; includes session ID for correlation | Session | Bizkaia Provincial Council | |
| dtSa | Intermediate storage for actions spanning pages | Session | Bizkaia Provincial Council | |
| rxVisitor | Visitor ID to correlate sessions | Constantly | Bizkaia Provincial Council | |
| rxvt | Session waiting time | Session | Bizkaia Provincial Council | |
| iyrc-user-id | Distinguish users | 1 year | Bizkaia Provincial Council | |
| _ga, _ga_XXXXXXXXXXX | Analysis | To distinguish users | 2 years | Google Analytics |
| _gat, _gat_XXXXXXXXXXX | Analysis | To limit the percentage of requests | 1 minute | Google Analytics |
| _gid | Analysis | To distinguish users | 1 day | Google Analytics |
In each row you can find data relating to Personalisation cookies
| Name | Purpose | Duration | Owner |
|---|---|---|---|
| Idioma | Select the language preferred by the user | 1 year | Bizkaia Provincial Council |
| cookie-tramites-favs | Save favourite procedures in Prior Appointment | 1 year | Bizkaia Provincial Council |
In each row you can find data relating to Third-party cookies
| Name | Purpose | Duration | Owner |
|---|---|---|---|
| CLID | Identify a user’s first visit | 1 year | Microsoft Clarity |
| APISID | Store user preferences and information during page views with Google maps in them. | 2 years | |
| HSID | Store user preferences and information during page views with Google maps in them. | 2 years | |
| MUID | Store user preferences and information during page views with Google maps in them. | 1 year | Microsoft Clarity |
| NID | Remember their preferences and other information | 6 months | |
| SAPISID | Show personalised advertisements on Google sites | 2 years | |
| SID | Provide advertisement delivery or retargeting, provide fraud prevention. | 2 years | |
| SIDCC | Provide reliable web traffic identification. | 1 year | |
| SM | Used to synchronise the MUID between Microsoft domains. | Session | Microsoft Clarity |
| SSID | Provide advertisement delivery or retargeting, provide fraud prevention. | 2 years | |
| __Secure-1PAPISID | Create a website visitor interest profile to show relevant and personalised Google advertising. | 2 years | |
| __Secure-1PSID | Create a website visitor interest profile to show relevant and personalised Google advertising. | 2 years | |
| __Secure-1PSIDCC | Create a website visitor interest profile to show relevant and personalised advertising through retargeting. | 1 year | |
| __Secure-1PSIDTS | Create a website visitor interest profile to show relevant and personalised advertising through retargeting. | 1 year | |
| __Secure-3PSID | 2 years | ||
| __Secure-3PSIDCC | Create a website visitor interest profile to show relevant and personalised advertising through retargeting. | 1 year | |
| __Secure-3PSIDTS | Create a website visitor interest profile to show relevant and personalised advertising through retargeting. | 1 year | |
| __Secure-ENID | Necessary cookies to use website services and options | 1 year | |
| ar_debug | Refine advertisements. | 1 año | |
| MR | Indicate when MUID is refreshed | 6 months | Microsoft Clarity |
| XSRF-TOKEN | Indicate when MUID is refreshed | 1 hour | Kultursistema |
| _fbp | Store and track website visits | 1 year | |
| kultursistema_session | Keep the user’s session | 1 hour | Kultursistema |
| AEC | Detect spam, fraud, and abuse | 6 months | |
| SOCS | Store user cookies preferences | 13 months | |
| Locale | not available | Basque government | |
| _hegoa_coop_session | Create a session ID for users | Session | Basque government |
How to deactivate or delete cookies?
When first accessing the Website, the user may configure and accept or reject the cookies on this Website. Subsequently, the user may change or withdraw their consent at any time via this Cookies Policy or the settings page.
However, you may exercise your right to freely deactivate them and even delete the cookies on this Website at any time. This is done differently depending on which browser you are using. Here is a quick guide for the most popular browsers.
- Deactivate Cookies in Chrome
- Deactivate Cookies in Explorer
- Deactivate Cookies in Firefox
- Deactivate Cookies in Safari
- Deactivate Cookies in Edge
If you deactivate or delete cookies, certain features of the Website may no longer function correctly.
Changes to the Cookies Policy
The Website reserves the right to change this Cookies Policy under the terms provided for by current legislation. We therefore recommend that you revise this policy each time you access our website to see any changes and read the pertinent information.
Configure cookies
We show you hereinbelow the different categories of cookies that our web page uses. You can personalise your choice by accepting or rejecting these categories through the buttons enabled to that end. For more information, consult our cookies policy (Opens modal window).
-
Technical Always active
These are needed to allow browsing on our website and for basic tasks related to correct website operation.
