Created
September 29, 2015 23:17
-
-
Save andrewjkerr/a682680c8540aef378b4 to your computer and use it in GitHub Desktop.
Solution for https://github.com/ufsit/sept-29-challenges
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, hashlib, urllib2, re | |
def hash(s, salt): | |
#Welcome to the Space Jam | |
h = hashlib.sha256() | |
#Here's your chance do your dance at the Space Jam | |
h.update(s + salt) | |
#Alright | |
return h.hexdigest() | |
rainbowtable = dict() | |
#Everybody get up it's time to slam now | |
req = urllib2.Request('http://www.warnerbros.com/archive/spacejam/movie/jam.htm') | |
#We got a real jam goin' down | |
salt = urllib2.urlopen(req).read() | |
infile = sys.argv[1] | |
infile2 = sys.argv[2] | |
print 'loading list...' | |
with open(infile, 'r') as f: | |
for l in f.readlines(): | |
rainbowtable[hash(l.strip(), salt)] = l.strip() | |
print 'done loading list!' | |
with open(infile2, 'r') as f: | |
for l in f.readlines(): | |
h = l.strip() | |
h = h.split(',') | |
h = h[1].strip() | |
if h in rainbowtable.keys(): | |
print h + ":" + rainbowtable[h] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment