From d9b142d8ada1791ec25dddcaec1bf19cae4b0321 Mon Sep 17 00:00:00 2001 From: Rebecca Hankey Date: Wed, 16 Apr 2025 11:38:17 -0400 Subject: [PATCH] When I was trying to figuer out the problem and how t slve it I started to plan like I do lessons. First I needed to goal (which was given to us) then I broke down the pieces of the goal and how they might be accomplished. Overall the code itself took a few tries to figure out. But for the most part the struggles I had were related to making the code I wrote compatable with the process that is already in place. For example, I struggled when importing some of the other equations, but once I stepped back and looked at the pieces of the solution I needed, they started to come together. I also loved that the codes were poems. It made my English teacher brain so excited. I started to look at the physical encryption and tried to guess the poems or genres. It was a really fun process! --- answers.md | 12 +++++++----- caesar_cracker.py | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 caesar_cracker.py diff --git a/answers.md b/answers.md index f125e69..3219eb1 100644 --- a/answers.md +++ b/answers.md @@ -3,19 +3,21 @@ ## Checkpoint 1 0. `secrets/secret0.txt` is encrypted using a Caesar Cipher. What is - its secret number? + its secret number? 78 + + I love sonnets, this made the English techer part of my heart grow three sizes. 1. `secrets/secret1.txt` is encrypted using a Caesar Cipher. What is - its secret number? + its secret number? 1 2. `secrets/secret2.txt` is encrypted using a Caesar Cipher. What is - its secret number? + its secret number? 44 3. `secrets/secret3.txt` is encrypted using a Caesar Cipher. What is - its secret number? + its secret number? 59 4. `secrets/secret4.txt` is encrypted using a Caesar Cipher. What is - its secret number? + its secret number? 32 ## Checkpoint 2 diff --git a/caesar_cracker.py b/caesar_cracker.py new file mode 100644 index 0000000..987b75b --- /dev/null +++ b/caesar_cracker.py @@ -0,0 +1,15 @@ + +from collections import Counter +from easybits import Bits + +def crack_caesar(ciphertext): + frequencies = Counter(ciphertext) + most_common = frequencies.most_common(1)[0] + most_common_character = most_common[0] + + space_value = Bits(' ').int + character_value = Bits(most_common_character).int + + shift = character_value - space_value + + return shift \ No newline at end of file