The Book Cipher Explained

A book cipher is a cipher where the plaintext letters (or words) are encrypted using a book (or other text document) as a kind of lookup table. Sender and receiver of encrypted messages can agree to use any book or other publication available to both of them. A book cipher has a considerable advantage for a spy in enemy territory since it does not raise suspicion (like e.g. a code book). The main strength of a book cipher is the key, because only being in possession of the original “book” allows the decryption.

Famous Examples of Book Ciphers

Cover of The Beale Papers (source Wikipedia)
  1. The most famous book ciphers are probably the “Beale ciphers”
    • The Beale ciphers are three encrypted documents
    • Only one of the documents has been successfully deciphered (using the United States Declaration of Independence as key)
    • The two other messages are still unsolved… (it is unclear, how these were encrypted)
  2. The “Arnold Cipher” was a book cipher used by John André and Benedict Arnold in 1780 during the American Revolutionary War
    • The book used as a key to the cipher was either “Commentaries on the Laws of by William Blackstone or Nathan Bailey’s Dictionary
    • The cipher consisted of a series of three numbers separated by periods:
    page number . Line number . word number
  3. The “Cicada 3301 online puzzle” series also contained book ciphers

The Book Cipher

First, the sender and the receiver have to agree on the (exact) same “book”. They also have to agree on an “encoding scheme”:
1. Encode single letters
2. Encode complete words


Also, they need to know “what” is encoded:
1. Page
2. Line
3. Word


1. Single Letter Scheme:
In the following, we show an example of a book cipher with the “single letter scheme”. It uses this sample text as key:

Example “book” used as key for encryption in the “single letter scheme”

To encrypt a plaintext, take a random word from the “book” above which starts with the plaintext letter you want to encrypt. Then, write the position of the word into the ciphertext. Go on, until you have encrypted the complete plaintext. In the following are two examples, how to encrypt plaintexts:

Example 1 (Write the offset of the word into the ciphertext):
H E L L O W O R L D –> 6 37 100 42 56 72 12 53 42 52

Example 2 (Write the line number and position of the word in the particular line into the ciphertext):
H E L L O W O R L D –> 09.04 04.08 12.03 05.08 05.09 08.06 06.03 07.07 12.03 06.09

Hint: With a real book, we could also prepend the page number.

2. Complete word scheme:
The “complete word scheme” is described in my YouTube video about the book cipher (see below). Also, I explain how to use a book cipher in CrypTool 2.

A YouTube Video About the Book Cipher

The Book Cipher Explained

Three Years “Cryptography for everybody” YouTube Channel

The “Cryptography for Everybody” YouTube channel, which is my YouTube channel about cryptography and cryptanalysis, is now three years old. On the October 8th, 2019 I started my channel as “CrypTool 2”, which I later rebranded to its current name. Early, I created my channel trailer, which image you can see here:

The old channel trailer

First idea of my channel was: Make videos about “CrypTool 2 Development”
– First series of the channel
– Today: Total of 10 development videos

My second idea was then: Make videos about CrypTool 2
– First video: “Break a Caesar Cipher” 🙂
– Today: Total of 40 videos about classical ciphers

Soon I got my next idea: Make a video series about cryptology
– First video: Part 1 (Cryptography – Terminology & Classical Ciphers)
– Today: Total of 25 videos about cryptology

Finally, I developed my YouTube channel to a channel about classic and modern cryptology (= cryptography and cryptanalysis). Here is an image of the new channel trailer with the rebranded design 🙂

The new channel trailer

A few facts of my YouTube channel:
Total Subscribers: 4,290 (2022-10-16)
Views: ≈ 280,000
Watch time: 16,910 ℎ𝑜𝑢𝑟𝑠 ≈ 705 𝑑𝑎𝑦𝑠 ≈1.93 𝑦𝑒𝑎𝑟𝑠 ≈2^19.95 𝑠𝑒𝑐𝑜𝑛𝑑𝑠
Uploaded videos: 138

A YouTube Video about the Three Years

I recorded a YouTube video and present much more history and channel facts. Watch it here 🙂

Three Years “Cryptography for Everybody”

The Syllabary Cipher Explained

In the linguistic study of written languages, a syllabary is a set of written symbols that represent the syllables or (more frequently) moras (basic timing unit in the phonology of some spoken languages) which make up words.

William F. Friedman and Lambros D. Callimahos present in “Military Cryptanalytics –  Part 1” a Syllabary cipher or Syllabary square on page 250. The American Cryptogram Association (ACA) also defines the Syllabary cipher as part of their list of ciphers:

Image of a „Syllabary square“ Source: Military Cryptanalytics – Part 1, Chapter XI,
April 1956, by Friedman and Callimahos

Klaus Schmeh mentions a cipher he calls Crypto Number Table and also presents a challenge on his online blog. The crypto number table is in fact the Syllabary cipher.

How does the Cipher Work?

The Syllabary cipher uses a 10×10 table that contains letters, syllables from a given language, and digits:

Original Friedman scheme (for English)

Basic ideas of the cipher are to suppress letter frequencies and to remove word patterns by different spellings of same plaintext words in the ciphertext.

To encrypt a plaintext, the text is replaced by digits  (coordinates) found on the top and left side of the table. Examples:

HELLO WORLD 1 → 53 65 65 74 06 77 65 31 12

You can find different ciphertexts encrypting the same plaintext:

SECRET  → 88 35 25 81 35 93
SECRET  →  89 25 83 93

To decrypt a ciphertext, you have to look up the plaintext element using the ciphertext symbol as coordinates.

Keying Schemes

There are three different keying schemes (also defined by ACA):

1. Keep table and modify digits on top and on the left of the table (based on a digit key, e.g.  10293847568475610293)
2. Keep digits on top and left of the table but  reorder table (based on a keyword, e.g. 8SECRET1KEYWORD5)
3. Modify digits (based on a key) and reorder table (e.g. based on keyword)

Digits and table changed (Scheme 3)

A YouTube Video About the Cipher

I created a YouTube video about the cipher that you can watch here:

The Syllabary Cipher Explained

References

A blog post from Klaus Schmeh about the cipher: https://scienceblogs.de/klausis-krypto-kolumne/2018/09/01/can-you-break-the-crypto-number-table-challenge/

Friedman, William Frederick, and Lambros D. Callimahos. Military cryptanalytics. Vol. 2. Aegean Park Press, 1985.

Halloween Update of “Cryptography for Everybody” YouTube Channel Header

I used the AI “Stable Diffusion” to create a few pumpkins and updated the YouTube channel header of “Cryptography for everybody”. The channel header is now changed on various occasions, such as Halloween, Christmas and Easter 🙂

YouTube Channel Halloween Header for “Cryptography for everybody”

You can watch my YouTube videos about cryptography and see the updated channel header here: https://www.youtube.com/c/CrypTool2
I also used the same header for the Facebook page of CrypTool 2: https://www.facebook.com/CrypTool2

The Nihilist Cipher Explained

The Nihilist cipher, a polyalphabetic substitution cipher used by Russian nihilists in the 19th century, is explained in this blog article. The cipher involves two keywords and a series of steps including the creation of a Polybius square, conversion of a second keyword into numbers, and encryption of plaintext using these numbers. The process for decryption is also outlined, requiring the same keywords and Polybius square. This article not only explains the cipher’s methodology but also provides a visual and practical approach to understanding its encryption process.

Before I wrote this article, I implemented the cipher in CrypTool 2, where you can now use the Nihilist cipher component for encryption and decryption of text using the Nihilist cipher.

In the following, I show the process of encryption using the cipher:

Step 1: Choose a first keyword and generate a Polybius square:
In our example here, we choose “KEYWORD“. We fill the keyword letters into a Polybius square and fill the remaining part of the square with the rest of the alphabet in alphabetical order. Our alphabet has a total of 25 letters, where I=J. Also, if a letter occurs twice or more in the keyword, we remove all other occurences of the corresponding letter:

The generated Polybius square using the keyword “Keyword”

Step 2: Choose a second keyword and generate a list of numbers:
Using the previously generated Polybius square, we convert a second keyword to a list of numbers. For example, the keyword “SECRET” we convert to:
45 12 25 21 12 51
We do so, by looking up the letters in the square and taking the digits on the left of the square as the first digit of the number and the column digit on top of the letter’s column as the second digit of the number.

Step 3: Encrypt the plaintext using the numerical key:
In the last step, we encrypt our plaintext by writing the key numbers below plaintext numbers, which we also generated using the same Polybius square. We repeat writing the keyword numbers below the plaintext numbers until we reach the end of the plaintext. Then, we add the plaintext numbers and key numbers to obtain the ciphertext:

Encryption of plaintext numbers using key numbers

The receiver of the encrypted message has to perform steps 1 and 2 with the same keywords to also generate the same Polybius square and same key numbers. To decrypt the ciphertext, he has to subtract the key numbers from the ciphertext numbers and then look up the corresponding plaintext letters in the Polybius square.

A YouTube video about the Nihilist cipher

I also created a YouTube video about the Nihilist cipher, which I uploaded to my YouTube Channel:

The Nihilist Cipher Explained

A CrypTool 2 Component and Workspace

I created a CrypTool 2 component and template, which implements the Nihilist cipher. Besides the “original” cipher with a Polybius square of 25 letters, it also allows to encrypt using a square with 26 letters and 10 digits:

A CrypTool 2 template showing the Nihilist cipher component

You can download CrypTool 2 from here.

The Bacon Cipher Explained

Francis Bacon was the 1st Viscount St Alban and lived from the 22nd January 1561 until the 9th April 1626. He was an English philosopher and statesman. Also, Bacon is seen as one of the fathers of modern science.

Portrait of Sir Francis Bacon. Frans Pourbus (1617), Pałac Łazienkowski, Warsaw

Despite that, he invented the after him named “Bacon cipher”, which is actually not a cipher but a steganographic method. It was published after his death in the book “Of the Advancement and Proficience of Learning or the Partitions of Sciences IX Bookes” (Bacon , Francis (1640) translated by Gilbert Wats, Oxford University. On pages 257 up to 271, you can read the “original” description of Bacon’s cipher. A digitized version of the book can be found here: https://www.biodiversitylibrary.org/item/86617#page/384/mode/1up

How Does the “Cipher” Work?

As mentioned above, the Bacon cipher is not a real cipher but it is a steganographic method. Bacon used it to hide secret texts within unsuspicious carrier texts. To do so, he used a “biliteral (hand-written) alphabet”.

His first step was to encode the plaintext using a code table:

Code table for the Bacon cipher (with binary representations)

For example, if you want to encode and then hide “HELLO WORLD”, you would do it like this:

First, you replace the “H” with “aabbb”, then you replace the “E” with “aabaa”, and so on:

Hello world example

Second, you hide the text using a bilateral alphabet. In our example here, the one alphabet uses bold letters and the other non-bold letters:

Hiding of the text

Here, you use the generated ab-pattern in the carrier text. We used non-bold letters for the “a”s and bold letters for the “b”s. The receiver has to reverse the order to obtain the hidden message. Clearly, we only transmit the carrier text and not the ab-pattern :-).

Bacon’s Original Cipher Alphabets

Bacon’s biliteral alphabets

Bacon used two different styles of hand-written alphabets. On the right side here, you can see a copy of the page of Bacon’s book showing these alphabets. As we can see, there are two styles for all uppercase and lowercase alphabet letters.

When Bacon wanted to hide his AB-pattern(s) in the text, he used the one alphabet style for “A”s and the other alphabet style for “B”s.

A YouTube Video About the Bacon Cipher

I also made a video about the cipher and uploaded it to YouTube 🙂

The Bacon Cipher Explained

Block Cipher Padding

When you encrypt using a modern block cipher (e.g. AES) the last plaintext block is often not exactly of block size bytes. To still allow the block cipher to encrypt it, we have to apply “padding”.

Padding adds data to the end of a message prior to the encryption. There is bit padding (which adds bits) and byte padding (which works on complete bytes). Here, we focus on byte padding.

Some examples for (byte) padding (modes) also implemented in CrypTool 2 are:
– “None” –> no padding at all
– 0-Padding –> adds zeros to the end of the block
– 1-0-Padding –> adds a one and then zeros to the end of the block
– ANSI X9.23 Padding –> adds zeros and the last byte is the number of padded bytes
– ISO 10126 Padding –> adds random bytes and last byte is the number of padded bytes
– PKCS#7 Padding –> adds the value n of padded bytes n-times to the end of block

In the video below of my “Cryptography for everybody” YouTube channel, I discuss what padding is, show all mentioned different padding modes, and also analyze these using CrypTool 2.

My Video about Block Cipher Padding

I Implemented the “Mexican Army Cipher Disk” and also its Cryptanalysis in CrypTool 2

In the last view days, I implemented the Mexican Army Cipher Disk and its cryptanalysis in CrypTool 2. I also made a YouTube video about that (see below in this blog post).

The Constitutionalists in Mexico used the Mexican Army Cipher Disk at the beginning of the 20th century during the Mexican revolution. It is a homophonic substitution cipher, but rather weak. For encrypting a letter, you have either a 3-symbol or a 4-symbol homophone group, with a total of 100 homophones (01 to 00).

My self-created Mexican Army Cipher Disk

The groups are created using the disk device, which consists of 5 disks (see shown figure above):
• The outer disk contains the Latin alphabet
• Four inner disks contain 2 digits numbers
• Four inner disks can be turned

The key of the cipher is the rotation of the four inner disks and can be described in two ways:
1) The digit groups below the letter A : 01, 27, 53, 79
2) With four Latin letters ; each letter is the one above the first digit group of the corresponding disk: A, A, A, A

Build your own Mexican Army Cipher Disk

Now, if you want to also build your own cipher disk, you may use my self-created template here:

Since I used powerpoint to create the template, the angles are not 100% perfect, but it still works well. You need to print it five times and always cut a smaller disk out of each printout. To get more stability, you may also use some cardboard and glue the disks onto these before assembling the device. Finally, all the disks are placed on top of each other. I used a paper clip that I bent and put through all the slices.

Cryptanalysis

If we want to break the Mexican Army Cipher Disk, it is a rather easy task. By hand, we just search in each number group (01 to 26, 27 to 52, 53 to 78, and 79 to 00) for the most frequent homophone. This stands probably for the letter E. Move your disks to all found E positions and you should be able to decrypt your ciphertext.

If you don’t want to break it by hand, you can use CrypTool 2 and the “Mexican Army Cipher Disk Analyzer” component for automatic cryptanalysis. It performs a brute-force attack and searches through all disk settings. Here, with the help of a language model (e.g. English pentagrams) it scores each of the decrypted texts. The correct plaintext should be on the first position of the best list of the analyzer.

YouTube Video

I alse created a YouTube video about the Mexican Army Cipher Disk. You may watch it here:

My YouTube video about the Mexican Army Cipher Disk

Some References

I Deciphered a Radio-Transmitted Enigma Message

On Saturday the 23rd July 2022, the Maritime Radio Historical Society (MRHS) and the Cipher History Museum sent an Enigma-encrypted radio transmission via the KPH stations. I was able to receive the message and decrypt it using CrypTool 2. Message was sent via Morse (CW) frequencies and radioteletype (RTTY) frequencies.

In one of my YouTube videos, I explain how I received the message using KiwiSDR and how the Morse decoding in KiwiSDR and the decryption process in CrypTool 2 worked. I thank Tom Perera from the cryptocollectors group for providing the playbacked parts of the original audio recording of the transmission. Finally, I recorded the wrong audio device, thus, I only had the video recording of what I did.

I Decrypted an Enigma Message Transmitted by Radio

Despite not being the fastest decipherer, I am proud that I received a very nice certificate. I got it after sending the plaintext to the Martitime Radio Historical Society via email:

My certificate for deciphering the Enigma message from the MRHS

If you want to try to decrypt the Enigma message on your own, here is my received and Morse-decoded message (actual ciphertext in bold):
FQ CQ DE KPH KPH KPH CQCQ CQ DE KPH KPH KPH CRYPTO MESSAGE FOLLOWS bt HQTRS FR FOCH 1914Z bt 100 bt BRV LTV bt VCXTY JRVHA NNKMO FGKIG OIPLM KVHVZ WDMIP XWRBX JKDWT KGZZA IWJVN QUTJF HPPWG KEDDQ QFEMT UKMQU IDIGF YUAJB RPPWS IBJCV EI[err][err]E CQ CQ CQ DE KPH KPH KPH CQ CQ CQ DE KPH KPH KPH CRYPTO MESSAGE FOLLOWS bt HQTRS FR FOCH 1914Z bt 100 bt BRV LTV bt VCXTY JRVHA NNKMO FGKIG OIPLM KVHVZ WDMIP XWRBX JKDWT KGZZA IWJVN QUTJF HPPWG KEDDQ QFEMT UKMQU IDIGF YUAJB RPPWS IBJCV E 5IH[err][err][err][err]EN SVAM bt I[err]

You can decrypt it using CrypTool 2 or any Enigma simulator. Here is a screenshot of the Enigma and settings in CrypTool 2:

Enigma set up for decryption of the message in CT2

Some references:

– To visit the MRHS, please go to: https://www.radiomarine.org
– The Cipher History Museum go to: https://cipherhistory.com/
– KiwiSDR you can find here: http://kiwisdr.com

Cryptography for everybody: Zero-Knowledge Proofs and Protocols Explained

In my newest video on “Cryptography for everybody”, I explain how zero-knowledge proofs and protocols work. A zero-knowledge proof or protocol is a method by which one party (usually Peggy P) can prove to another party (usually the verifier Victor V) that they know a value (e.g. a secret key or password) without actually revealing it.

First, we discuss the classical cave example by Quisquater: Here, Peggy wants to prove to Victor that she knows how to open a secret door in a cave. But only to Victor and not to anyone else.

Then, we have a look at a real zero-knowledge protocol: the Fiat-Shamir Protocol. This protocol works with modular arithmetic. Peggy has to create a private key s and register her public key v = s² with a trusted third party. Then, Victor can challenge her with a simple protocol. How this works, I explain in the video.

Finally, we have a look at the zero-knowledge simulation in CrypTool 2. Watch the video here:

Zero-Knowledge Proof Explained

“Cave” paper by Quisquater: Quisquater, Jean-Jacques, et al. “How to explain zero-knowledge protocols to your children.” Conference on the Theory and Application of Cryptology. Springer, New York, NY, 1989.

Feige-Fiat-Shamir protocol: Feige, Uriel, Amos Fiat, and Adi Shamir. “Zero-knowledge proofs of identity.” Journal of cryptology 1.2 (1988): 77-94.