A Brief Introduction to Cryptography

Codebase
Berkeley Codebase
Published in
4 min readAug 2, 2022

--

Hello! An-yeong! ¡Hola! Bonjour! Zrxxt…?

If you’re confused by the last word, don’t worry. That’s the point of cryptography. Cryptography itself is the study of encrypting messages. Going back to the first paragraph, the last word is an example of a monoalphabetic substitution — ”H” is replaced by “Z”, “e” is replaced by “r”, “l” is replaced by “x”, and “o” is replaced by “t”. In this case, “Hello” is the plaintext and “Zrxxt” is the ciphertext, and the method of encryption is referred to as a cipher. The goal of encrypting messages is to ensure that only the sender and intended recipient(s) can figure out the contents of the ciphertext (encoded plaintext).

Throughout human history, cryptography has been used by prominent historical figures like Julius Caesar to aid in military communications. The current usage of cryptography, however, spans far beyond the scope of the military. While my first exposure to cryptography was through a Science Olympiad event called Codebusters, it didn’t take me long to find instances of cryptography in my everyday life. From our email exchanges to credit card purchases, we depend on cryptography to ensure our data is protected. So, how did we get to this point?

Cryptography blends together disciplines including but not limited to statistics, linguistics, and even religion. Linguistics and statistics are combined in the form of frequency analysis. In frequency analysis, one can find how often each letter shows up in the ciphertext and match it to the most common letters in the English alphabet. Frequency analysis was developed as a result of theological schools analyzing the revelations of Muhammed and discovering specific linguistic patterns.

For our previous example, we can take the most frequent letters in the English alphabet (ETAION) and substitute them into “Zrxxt” until it makes sense (Note: frequency analysis is most effective when used on longer messages rather than shorter ones, like “Hello”). Frequency analysis is considered a brute force method, and it can be used on some, but not all ciphers.

We obviously don’t want to use encryption methods that are easily brute forced, especially when it comes to our sensitive information. Cryptography, therefore, is constantly evolving to outrun cryptanalysis, which is the field dedicated to breaking these ciphers.

It’s a constant tug-of-war between the fields of cryptography and cryptanalysis; when cryptographers develop a more secure encryption algorithm, it’s only a matter of time until cryptanalysts find a way to decode them efficiently. The ciphers of Julius Caesar’s time are extremely outdated; you could solve a ciphertext encoded in the Caesar cipher within a second using a computer. Such ciphers have been replaced by modern-day cryptographic algorithms like Rivest–Shamir–Adleman (RSA) and Advanced Encryption Standard (AES). Nevertheless, we can expect RSA and AES to eventually be replaced with stronger ciphers as well.

If you’re interested in the linguistic ciphers, I’d recommend trying out an Aristocrat, Patristocrat, and Caesar cipher. Here are some online (and free!) cryptanalysis resources:

  1. This website randomly generates encrypted quotes using Aristocrats (the same cipher we used for “Zrxxt”). It comes with a letter frequency chart that you can use to analyze the linguistic patterns in the messages: https://cryptograms.puzzlebaron.com/play.php
  2. This website was my go-to when I competed in the Codebusters event, but I still revisit it when I’m looking for some fun cryptanalysis exercises. Each sample test contains cryptanalysis exercises of varying lengths and ciphers: https://toebes.com/codebusters/samples.html

If mathematical ciphers are more of your thing, I’d suggest looking into the Euclidean algorithm, Fermat’s little theorem, Diffie-Hellman key exchange, Hill cipher, and Chinese Remainder Theorem. There are also a variety of cryptography-related proofs that you may find fascinating!

Lastly, here are two book recommendations if you’re interested in learning more about cryptography!

  1. The Code Book by Simon Singh: A wonderful read that delves into the history of cryptography and its evolution into the cryptography we know today.
  2. The Rose Code by Kate Quinn: A fictional tale based on the secret taskforce of female codebreakers in World War II.

With its combination of so many disciplines, there’s a place for everybody in the field of cryptography! I would recommend reading up on ciphers beyond the ones mentioned here and the history of how each came to be. I barely scratched the surface of cryptography, but I hope you take the time to study and even try decoding the ciphers of the past and present on your own. Feel free to reach out if you’d like to further discuss cryptography or have any questions!

This blog is written by Angelina Lee, a Codebase member. Find her at angelinalee@berkeley.edu and definitely reach out if you share any interests!

--

--

Codebase
Berkeley Codebase

Software development @ UC Berkeley — Building a community for meaningful industry impact. https://codebase.berkeley.edu/