Skip to content

Instantly share code, notes, and snippets.

@danpalmer
Created March 30, 2014 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danpalmer/9877046 to your computer and use it in GitHub Desktop.
Save danpalmer/9877046 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import numpy as np
input = open("stage2-input.bin", "rb").read()
bin = map(int, list(''.join(map(lambda s: s[2:], map(bin, map(ord, list(input)))))))
results = np.correlate(bin, bin, mode='full')
results = results[results.size/2:]
plt.plot(results[0:255])
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment