Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from hashlib import md5
- from itertools import compress, product
- from string import printable
- from binascii import hexlify
- def allcombos(values, max=None): # generator for yielding cartesian products of a certain set of characters
- values = set(values) # erases repeating characters if any...
- lenVal = len(values)
- max = max if max is not None and max <= lenVal else lenVal
- for i in range(0, max+1): # loop through all cartesian products from 0->len(max)
- for p in product(values, repeat=i):
- yield ''.join(p)
- def tryReplace(origVal, newVal, lst):
- for i, item in enumerate(lst):
- if origVal == item:
- lst[i] = newVal
- return lst
- def foo(hashCollection): # string of characters... just md5's put together
- size = 32 # 32 characters for an md5 hash
- hashList = [hashCollection[i:i+size] for i in range(0, len(hashCollection), size)]
- hashList = filter(lambda x: len(x) == size, hashList) # removes any that are not the same size as md5's
- for combo in allcombos(printable, 3): #only loop through 3 at most... otherwise, it may be a LONG time
- m = md5()
- m.update(combo)
- hashList = tryReplace(hexlify(m.digest()), combo, hashList)
- return hashList
- name = (
- "7fc56270e7a70fa81a5935b72eacbe29" # A
- "0b3b97fa66886c5688ee4ae80ec0c3c2" # us
- "2cb1b780138bc273459232edda0e4b96" # tin
- "cd4a2e8261ac0bdd29f6844dd4a615bc" # @ar
- "d88fc6edf21ea464d35ff76288b84103" # ch
- "818f9c45cfa30eeff277ef38bcbe9910" # er
- "NotAnMD5"
- )
- thisAlsoWorks = "7fc56270e7a70fa81a5935b72eacbe290b3b97fa66886c5688ee4ae80ec0c3c22cb1b780138bc273459232edda0e4b96cd4a2e8261ac0bdd29f6844dd4a615bcd88fc6edf21ea464d35ff76288b84103818f9c45cfa30eeff277ef38bcbe9910"
- attempt = foo(thisAlsoWorks) # or foo(name)
- print ''.join(attempt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement