about summary refs log tree commit diff
path: root/users/wpcarro/scratch/cryptopals/set1/c4.py
blob: c546419a3388b269389a141598518eec6c70d97d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import c3

content = None
with open('4.txt', 'r') as f:
    content = f.read().splitlines()
if not content:
    raise Error("Need content to proceed")

xs = []
for line in content:
    try:
        x = c3.decode_cipher(line)
        if x: xs.append(x)
    except:
        continue

freqs = c3.frequency_table()
print(max(xs, key=lambda x: c3.score(x, freqs)))

################################################################################
# Answer
################################################################################
"Now that the party is jumping"