Skip to content

Instantly share code, notes, and snippets.

@AntonKueltz
Created December 22, 2014 07:23
Show Gist options
  • Save AntonKueltz/287c774f28ecf2f816e8 to your computer and use it in GitHub Desktop.
Save AntonKueltz/287c774f28ecf2f816e8 to your computer and use it in GitHub Desktop.
def detect_single_byte():
f = open('Data/4.txt')
best_freq, ptxt = 0, ''
for ctxt in f.read().split('\n'):
raw = ctxt.decode('hex')
txt = single_byte_cipher(raw)
cur_freq = char_freq(txt)
if cur_freq > best_freq:
best_freq = cur_freq
ptxt = txt
f.close()
return ptxt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment