From 08b24a3baacacfc075c2bc7b40f74134c1911920 Mon Sep 17 00:00:00 2001 From: caglazir2 Date: Sun, 10 May 2026 16:48:26 -0400 Subject: [PATCH] Submitted the changes previously made. Checkpoint 2: a strategy I used was simialr to the example given on the website. I used the most commonly used characters as a way of tracking the frequency. --- .envrc | 1 + caesar_cracker.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .envrc create mode 100644 caesar_cracker.py diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..4a96c22 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +source .venv/bin/activate \ No newline at end of file diff --git a/caesar_cracker.py b/caesar_cracker.py new file mode 100644 index 0000000..3dd4cf4 --- /dev/null +++ b/caesar_cracker.py @@ -0,0 +1,19 @@ +from easybits import Bits +from ciphers.caesar import CaesarCipher +from collections import Counter + +def crack_caesar(enc_text): + counts = Counter(enc_text) + count_keys = list(counts.keys()) + count_vals = list(counts.values()) + most_freq=counts.most_common(1)[0][0] + print(type(most_freq)) + secret_num = Bits(most_freq).int - Bits(' ').int + cipher = CaesarCipher(secret_num) + print(cipher.decrypt(enc_text)) + + + + + +