generated from mwc/lab_encryption
Writing code helped me understand the problem better
because I could actually test what was happening instead of just guessing. It made it easier to see how encryption and decryption work step by step, and I could quickly fix mistakes when something didn’t work. I had trouble finding the secret word at first because I was only getting numbers when I calculated the shifts. I couldn’t turn that into a readable word, so I used the secret word provided by the professor instead. Then I used that word in PolyCipher to decrypt the message and check that it worked.
This commit is contained in:
8
caesar_cracker.py
Normal file
8
caesar_cracker.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from collections import Counter
|
||||
from easybits import Bits
|
||||
|
||||
def crack_caesar(ciphertext):
|
||||
counts = Counter(ciphertext)
|
||||
most_common_char = counts.most_common(1)[0][0]
|
||||
shift = Bits(most_common_char).int - Bits(' ').int
|
||||
return shift
|
||||
Reference in New Issue
Block a user