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.
This commit is contained in:
caglazir2
2026-05-10 16:48:26 -04:00
parent 5a0b6be2ef
commit 08b24a3baa
2 changed files with 20 additions and 0 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
source .venv/bin/activate

19
caesar_cracker.py Normal file
View File

@@ -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))