import re,md5,hashlib password = open('bob', 'r').read() # open the simplified file dec = re.compile(r'[^\d]+') # regex to eliminate non-number chars password = dec.sub('', password) # eliminate the chars init = md5.new(password) # create an md5 object with the first # 1,048,568 chars # Loop through the keyspace for i in range(0,99999999): # Print the count every 100,000 iterations if i%100000 == 0: # because I am impatient print i tmp = init.copy() # Create a copy of the md5 hash to manipulate tmp.update(str(i).zfill(8)) # Do the hash extension with i test = tmp.hexdigest() # Compute the hash # If the md5 is correct, we win! if test == '287d3298b652c159e654b61121a858e0': print 'Answer found!' print hashlib.sha1(password+str(i).zfill(8)).hexdigest() breakThis script finished after about 1 to 2 minutes somewhere around the 68,000,000th try.
-- suntzu_II
No comments:
Post a Comment