Monoalphabetic ciphers

Cryptographic algorithms enable private communication between two parties by allowing a sender to encrypt messages that only the recipient of the message can decode. Some of these algorithms are monoalphabetic ciphers.

Monoalphabetic ciphers are a type of substitution cipher, where every letter in a message is replaced by another letter. For example, two parties might agree to always replace the letter A with the letter X when encrypting their messages. The recipient can then decode the message by reversing the substitutions. In order to work, this requires both the sender and recipient to have a common dictionary that maps all letters of the alphabet to their substitutions.

A specific variant of monoalphabetic ciphers is the Caesar cipher. This cipher works by replacing each letter in a message with another letter that is a fixed number of positions away in the alphabet. Now, instead of needing to share a full dictionary mapping, the two parties only need to share a single numeric key between them. For example, if the two parties agree to use a key of 3, then they would translate every letter A (1st letter of alphabet) in their message to the letter D (1st letter + key 3 = 4th letter of alphabet).

Here's an example of a full plaintext message and the encrypted ciphertext when using a Caesar cipher with a key of 3:

Plaintext:  THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
Ciphertext: WKH TXLFN EURZQ IRA MXPSV RYHU WKH ODCB GRJ

As you can imagine, the Caesar cipher is fairly simple for third parties to decode even if they don't have access to the private key. Attackers can intercept and decode communications if they know any part of the plaintext message or if they analyze the frequency of letters in the message to make educated guesses for the key's value.

To increase the difficulty of hacking such ciphers, the polyalphabetic cipher was invented.

Polyalphabetic ciphers

The polyalphabetic cipher is a substitution cipher in which each letter of the message uses a different dictionary mapping during encryption. The Enigma machine used by Nazis during World War II is a famous example.

Another example polyalphabetic cipher is the Vigenère cipher. This cipher calculates substitutions in the same way that the Caesar cipher does, but each letter of the message is assigned a different key. Thus, instead of a single numeric value, the Vigenère cipher requires the two parties to share a private keyword. For example, a keyword of POTATO would mean that the first letter of the message would be encrypted with a Caesar cipher where A was replaced with P (key = 15), the second letter of the message would be encrypted with a Caesar cipher where A was replaced with O (key = 14), the third letter of the message would be encrypted with a Caesar cipher where A was replaced with T (key = 19), etc. Once all the letters of the keyword are used, the sender starts again from the P to continue encrypting the rest of the message.

Here's a full plaintext message and the encrypted ciphertext when using a Vigenère cipher with a keyword of POTATO:

Plaintext:  THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 
Ciphertext: IVX QNWRY URHKC THX CIBDL OOSG HAE EOOM WOZ

While more difficult to crack than the monoalphabetic cipher, these ciphers are also possible to crack. Attackers can guess the length n of the keyword and divide the message into n-sized strings. At that point, they're only dealing with cracking multiple Caeser ciphers! And in fact, the Enigma machine was famously broken by the Polish General Staff's Cipher Bureau.

So what cryptographic algorithms aren't possible to crack? Find out here in a future post!