Data Encryption: When Homer's Mom Writes to Him

Web Apps
Tips & Tricks
< | 3-minute read | Pavel />
encrypting homer
In a short series of articles, we will focus on text and data encryption, cryptography, and how to securely transmit data. In this installment, we will look at classical ciphers, demonstrating one with an example from The Simpsons. Future articles will cover the Enigma machine, symmetric and asymmetric encryption algorithms. The final installment will focus on the practical use of encryption in electronic signatures.

Encryption is a process where a generally readable sequence of data (such as text or a document) is transformed into an encrypted sequence of data using an encryption key. Without the knowledge of the encryption key, the encrypted data (such as text) is unreadable. Classical cryptography deals with basic forms of encryption, many of which can be implemented using just paper and pencil.

Steganography: When Homer's Mom Writes to Him

A steganographic cipher works on the principle of hiding an encrypted message within another piece of content. Steganographic ciphers have even appeared in The Simpsons. In the fifteenth season, second episode, Homer's mother Mona sends messages to Homer using a steganographic cipher. She places an article about food in the local newspaper, and if Homer reads the first letters of each line, he will receive a message from his mother.

Another example of a steganographic cipher is hiding one image inside another image. In the image below, another image is hidden. This is done by embedding additional information within each pixel of the original image.

hidden_image.png
An image where another image is hidden using a steganographic cipher

A disadvantage of steganographic ciphers is the length of the resulting encrypted text or data. Homer's mother Mona needed an entire article to convey a simple sentence to Homer. Similarly, the encrypted image has an original size of 1 MB to hide an image of 143 kB.

new2.png
he decrypted image from the original.

Substitution ciphers, or the first algorithmic cipher

Substitution ciphers operate on the principle where each character or symbol is replaced by another. The very first algorithmically solved encryption was indeed a substitution cipher, specifically the Caesar cipher.

The Caesar cipher operates on the principle where each letter is shifted three positions forward. Thus, all A's are replaced by D's, all B's by E's, and so on. The principle of this encryption is simple, which brings with it the disadvantage of easy cipher breaking. The biggest drawback of this approach is that anyone who knows the encryption algorithm can break the cipher. Among other disadvantages of the Caesar cipher is the small number of encryption keys. The key to encryption and decryption lies precisely in the letter shift. If we take the number of letters in the English alphabet (26), it results in 25 possible shifts before the encrypted letter maps back to itself.

Monoalphabetic substitution cipher, or an improved Caesar

The monoalphabetic substitution cipher was unbreakable throughout the first millennium AD. It was partially inspired by the Caesar cipher. The encryption key was a table where each letter of the alphabet was "randomly" mapped to another letter of the alphabet. This meant there were 26! (which is 4×1026) possible key variants used for encrypting and decrypting the original text.

Example of an encryption key:

Alphabet:abcdefghijklmnopqrstuvwxyz
key:PDUIRMFOHSBNCGVKTJWEYAQXZL

Encryption would then look like this:

Plain texthello word
Encrypted textORNNV QVJI

Frequency analysis of encrypted text

Frequency analysis is a mathematical approach to analyzing and breaking encrypted text, which is a weakness of both Caesar cipher and monoalphabetic substitution ciphers. This method relies on statistical knowledge of natural language. The essence lies in understanding the frequency of occurrence of individual letters and characters in the natural language. For example, in English, the most commonly used letters are E, T, A, O, I, N, S, H, and R. In encrypted text, these letters will appear in proportion to how they are mapped from the original alphabet. The strength of frequency analysis is most evident when the attacker has access not only to the encrypted text but also to a portion of the plaintext. At that point, the key can be deciphered relatively easily, and then applied to decrypt other encrypted data, revealing the information.

In future articles, we will explore other classic ciphers. We will gradually move on to symmetric and asymmetric encryption algorithms, which are used, for example, in encrypting data for browsing websites (HTTPS protocol) or for electronic signatures.

If you are interested in collaborating on the development of websites, web systems, or mobile applications, please do not hesitate to contact us.

Newest articles

<Technology and client stories />

Global Windows System Outage – What Happened and How to Prevent It?

How to Recognize an Outdated Website (Webosaurus) and Why You Need Modernization

Why Get a Custom Website?