The Caesar cipher, also known as the shift cipher, is one of the simplest and oldest encryption methods. It works by shifting each letter in the plaintext by a fixed number of positions down or up the alphabet. To use it, you first choose a key—an integer between 1 and 25—that determines how many positions each letter will be shifted. For example, with a shift of 3, the letter A becomes D, B becomes E, and so on, wrapping around to the beginning of the alphabet if necessary (so Z would shift to C). This was implemented by using the modulo of 26 to get each ASCII element to correspond to a number 0-25 that would directly relate to the number instead of using the ASCII elements each time.
To encrypt a message, each letter is replaced by the letter that comes shift positions after it in the alphabet. For instance, the word HELLO encrypted with a shift of 3 becomes KHOOR. Decryption reverses the process of encryption by shifting each letter backward by the same number. The cipher is case-insensitive unless specified otherwise, and non-alphabet characters like numbers and symbols typically remain unchanged. However, because there are only 25 possible shifts, the Caesar cipher is highly vulnerable to brute-force attacks or frequency analysis, making it unsuitable for modern security but useful for teaching basic cryptography.
Mathematically, encryption and decryption can be represented using modular arithmetic. The ciphertext letter C is calculated as
C=(P+K)mod26, where P is the plaintext letter (with A=0, B=1, etc.) and K is the shift key. Decryption uses
P=(C−K)mod26. Despite its weaknesses, the Caesar cipher remains a foundational concept in cryptography, often used in puzzles, games, and as an introduction to more complex encryption techniques.
Our project for this unit was a scavenger hunt for a cow. We were given 5 clues and had to decode them before we were given the next. After solving the fifth clue, we could go to the specified place and retrieve the prize. The first four clues were easy to decode and only required being put into the algorithm we made to try every possibility of a simple Caesar Cypher to solve. However, the last clue was difficult to decode because it had a multi-digit key, where each letter of the message was shifted by a different number of places. I solved this by analyzing the few letters of the solved code: The cow loves candies as much as... since we knew the first 6 digits of the code from the previous hint, we could figure out that the first 6 characters were: The co. Using deductive reasoning, we figured out that the seventh number had to turn an "f" into a "w" since this was decoding, we went backwards and got 9 as the difference.
The five hints we got about the location of the cow were:
Clue 1: Ms. Tran left her gate open.
Clue 2: Raul saw the cow hanging out with JH kids in the JH cue and eating mint candy.
Clue 3: Ms. Tran recalls seeing Ms. Sanchez eating the same mint candy.
Clue 4: Ms Tran found a Call me candy wrapper with a phone number in it: 650806…
Clue 5: The cow loves candies as much as you do. No one stole it. It walked to Ms. Sanchez’s office to get his favorite snack.
Final key for clue 5 that we figured out: 6508069278
Here are the screenshots of the code I used:
SOUL REFLECTION:
S - Strength: I feel like I used an efficient method to solve the hints, plugging them in and finding the correct code.
O - Opportunities: I could've spent more time trying to figure out the fifth key using other hints instead of brute forcing it.
U - Understanding: I think I've developed a new understanding of Caesar Cyphers and how encoding works throughout the lessons . I now have the ability to create a basic decryption software without too much guidance.
L - Limitations: I only could make my decoder work when you knew the key to the text. Because there are so many different ten bit codes, I couldn't get the code to go through all of the possibilities.
WISCR REFLECTION:
Well-Rounded: I was well rounded throughout this project because I learned vastly different elements of coding, libraries in python and looping with i.
Clear Communicator: I was being a clear communicator during this project because I talked with my partner and strategized how to go about solving the key quickly.