generated from mwc/lab_encryption
9 lines
253 B
Python
9 lines
253 B
Python
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
|