Code Breaking — Caesar Cipher

Ryan Howe
10 min readAug 3, 2024

Intro

Some of my fondest memories are of going to breakfast with my Dad when I was a kid. We would go to a nearby diner in my hometown and there was a word jumble written on a chalkboard next to the daily specials. There were generally five or six short words between four to eight letters and I’d try to race through them to get the real words by rearranging them. As I got older I enjoyed solving others types of puzzles, including cryptographic ones. Lately though I have not solved many but I try to do various games and language learning tests each day.

Note : I used ChatGPT to help generate some code and or add annotations and docstrings

Implementing a basic Caesar cipher

For this article I want to implement a basic Caesar cipher in Python and then try to break the code. I know that I’ve implemented some cryptographic ciphers before however I don’t think I’ve ever put much thought in the breaking part. I’ll note that this is somewhat exploratory and I imagine there are much faster and or more comprehensive scripts or articles about this. For those who don’t know the Caesar cipher is a simple encryption method that is also known as the shift cipher. It can be described as the following

In cryptography, a Caesar cipher, also known as Caesar’s cipher, the shift cipher, Caesar’s code, or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the…

--

--