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:

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 🙂

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.

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:

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.

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

Highlights of the International Conference on Historical Cryptology 2022 (HistoCrypt 2022)

I attended the International Conference on Historical Cryptology in June 2022. The conference took place in Amsterdam and was the first real conference, after the previous two HistoCrypts’ live events (2021 in Amsterdam and 2020 in Budapest) unfortunately had to be canceled due to the ongoing COVID-19 pandemic.

HistoCrypt 2022 was a great conference organized locally by Karl de Leeuw, a good colluege and great researcher who sadly passed away only three weeks after the conference in Amsterdam.

The conference featured 9 tracks, each track covering a different main topic, like crypto machines, historical documents, or machine learning. I had the opportunity to present together with Michelle Waldispühl our work about deciphering encrypted letters sent and received by Holy Roman Emperor Maximilian II in 1574 and 1575. Also, I was able to showcase CrypTool 2 in the poster session (I published a paper about new components in CrypTool 2). Jörgen Dinnissen presented our paper about a cipher of the Dutch East India company from 1674. Nino Fürthauer talked about our work with solving transposition ciphers using machine learning and Beáta Megyesi presented our work on analyzing thousands historical encryption keys.

All Talks Summarized in a YouTube Video

Today, I also created a YouTube video summarizing all talks given at HistoCrypt. You can watch it here:

Papers on HistoCrypt 2021 and HistoCrypt 2022 I (Co-)Authored

I co-authored six papers in the last two HistoCrypts being first-author in two:

Megyesi, B., Tudor, C., Láng, B., Lehofer, A., Kopal, N., & Waldispühl, M. (2022, June). What Was Encoded in Historical Cipher Keys in the Early Modern Era?. In International Conference on Historical Cryptology (pp. 159-167).

Fürthauer, N., Mikhalev, V., Kopal, N., Esslinger, B., Lampesberger, H., & Hermann, E. (2022, June). Evaluating Deep Learning Techniques for Known-Plaintext Attacks on the Complete Columnar Transposition Cipher. In International Conference on Historical Cryptology (pp. 82-90).

Kopal, N., & Esslinger, B. (2022, June). New Ciphers and Cryptanalysis Components in CrypTool 2. In International Conference on Historical Cryptology (pp. 127-136).

Dinnissen, J., & Kopal, N. (2021, August). Island Ramanacoil a Bridge too Far. A Dutch Ciphertext from 1674. In International Conference on Historical Cryptology (pp. 48-57).

Kopal, N., & Waldispühl, M. (2021, August). Two Encrypted Diplomatic Letters Sent by Jan Chodkiewicz to Emperor Maximilian II in 1574-1575. In International Conference on Historical Cryptology (pp. 80-89).

Leierzopf, E., Kopal, N., Esslinger, B., Lampesberger, H., & Hermann, E. (2021, August). A massive machine-learning approach for classical cipher type detection using feature engineering. In International Conference on Historical Cryptology (pp. 111-120).

HistoCrypt 2022 in Amsterdam – A Video made by Klaus Schmeh

My good friend and crypto author and blogger Klaus Schmeh made a really nice video about HistoCrypt 2022 (you can see me a couple of times in the video :-)), which took place last week in Amsterdam. I was also in Amsterdam and had the opportunity to present our work on Maximilian II ciphers together with Michelle Waldispühl, as well as to present CrypTool 2 in the poster session.

HistoCrypt 2022 was a great event where every talk was fascinating for crypto enthusiasts and researchers. Next year, HistoCrypt 2023 will likely be held in Munich, and the following HistoCrypt 2024 will likely be in Oxford.

Over the next weeks, I will probably also create a video and show some of the highlights of HistoCrypt 2022.

Visit Klaus Schmeh’s blog here: http://www.cipherbrain.de

Visit the HistoCrypt website: https://www.histocrypt.org

Cryptography for Everybody: The ASCII Enigma – An Enigma Machine with 256-Pin Rotors

Recently, I created the “TextAES”, an AES-like cipher, where each building block of the original AES was replaced by a classical cipher. Of course, I also made a video about that and uploaded it onto my YouTube channel 🙂

After getting some feedback on my corresponding blog article here, I created the ASCII Enigma. An Enigma machine with 256-pin rotors. The basic idea was to create an Enigma machine that resembles the original design, but allows the encryption of more then the standard 26 Latin characters.

Three new Enigmas

In total, I developed three different new Enigmas and programmed these in C#: the Morse Enigma, the Enigma64, and the ASCII Enigma.

The Morse Enigma allows the encryption of more than 26 letters, but it still only uses symbols, that can be sent using Morse code. The main idea was, that this machine could have been built in the 1940s and Morse code was the state-of-the-art transmission media for messages. This Enigma machine has rotors with 38 pins. It allows the encryption of the letters A-Z, digits 0-9, and four special characters ( . , ! ? ).

The next Enima is the Enigma64. It allows the encryption of uppercase letters A-Z, lowercase letters a-z, digits 0-9, and two special characters ( . , ). My idea here is, that the created ciphertexts can still be represented using printable characters. By replacing . and , with / and +, the machine could easily by converted to a “Base64 Enigma”.

The last and most powerful Enigma I created is the ASCII Enigma. It allows the encryption of all 256 ASCII symbols. Since a lot of these are not printable, the resulting ciphertexts should be either converted to Base64, Hex values, or just stored in a binary file.

The C# Code

My C# code does not only allow to create these “fantasy” Enigmas, but also to create original Enigmas. I implemented the Enigma 1 for testing my code. Finally, one can also create Enigmas with only 1 or even 1,000 rotors. It can be easily done using only a few C# statements. Below you see how to create an Enigma 1:

int[] key = new int[] { 0, 1, 2 }; // A B C <--> we work on numbers instead of letters

//create plugboard with three plugs
int[][] plugs = new int[3][];
plugs[0] = new int[] { 0, 1 }; // plug A <-> B
plugs[1] = new int[] { 2, 3 }; // plug C <-> D
plugs[2] = new int[] { 4, 5 }; // plug E <-> F

//create rotors for machine
Rotor rotor1 = new Rotor(MapTextIntoNumberSpace(Enigma1.RotorI, Alphabets.Alphabet26), Enigma1.RotorINotches, 0);
Rotor rotor2 = new Rotor(MapTextIntoNumberSpace(Enigma1.RotorII, Alphabets.Alphabet26), Enigma1.RotorIINotches, 0);
Rotor rotor3 = new Rotor(MapTextIntoNumberSpace(Enigma1.RotorIII, Alphabets.Alphabet26), Enigma1.RotorIIINotches, 0);
Rotor reflector = new Rotor(MapTextIntoNumberSpace(Enigma1.UKWA, Alphabets.Alphabet26), null, 0);

//create machine
RotorMachine enigma1 = new RotorMachine(new Rotor[] { rotor1, rotor2, rotor3 }, reflector, new Plugboard(Alphabets.Alphabet26, plugs), Alphabets.Alphabet26);

//reset machine key
enigma1.Key = key;

//plaintext:
string text = "HELLOXWORLDXTHISXISXAXTESTXTEXT";
Console.WriteLine(text);

//encrypt/decrypt and print all to console
int[] plaintext = MapTextIntoNumberSpace(text, Alphabets.Alphabet26);
int[] ciphertext = enigma1.CryptText(plaintext);
Console.WriteLine(MapNumbersIntoTextSpace(ciphertext, Alphabets.Alphabet26));

//reset machine key
enigma1.Key = key;

int[] decrypted = enigma1.CryptText(ciphertext);
Console.WriteLine(MapNumbersIntoTextSpace(decrypted, Alphabets.Alphabet26));

Here, we create an Enigma 1 with three rotors (I, II, III), a plugboard, and the reflector UKWA. My implementation does not take the “rings” into account since these are cryptographically irrelevant. And it eased the code :-). If you want to have an implemention of the Enigma with rings, have a look at CrypTool 2.

My YouTube Video and the Source Code

Of couse, I also made a video about the ASCII Enigma:

If you are interested in getting your hands on the source code, I created a GitHub project where you can get it from: https://github.com/n1k0m0/ASCIIEnigma

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:

“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.