generated from mwc/lab_encryption
Unfinished encryption lab answers.
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]
|
||||
shift = Bits(most_common_char).int - Bits(' ').int
|
||||
return shift
|
||||
Reference in New Issue
Block a user