In [7]:
myinput = 'iwrupvqb'
In [11]:
import hashlib
def md5hash(mystr):
hasher = hashlib.md5()
hasher.update(mystr.encode('utf-8'))
return hasher.hexdigest()
def decypher(mystr):
low = int('0x' + '0'*5 + 'f'*27, 16)
i = 1
while (int(md5hash(mystr + str(i)), 16) > low):
i += 1
return i
In [12]:
decypher(myinput)
Out[12]:
In [13]:
def decypher(mystr):
low = int('0x' + '0'*6 + 'f'*26, 16)
i = 1
while (int(md5hash(mystr + str(i)), 16) > low):
i += 1
return i
In [14]:
decypher(myinput)
Out[14]: