I am trying to calculate MD2 hashes using PyCrypto until i find one or more starting with a given string. (Please don't ask why :=)
I am able to find several hashes. If i check the correctness of my hash calculation via online tools, i will not get the same hash.
Code:
import itertools
from Crypto.Hash import MD2
charset = 'abcdefghijklmnopqrstuvwxyz0123456789'
md2hasher = MD2.new()
res = itertools.product(charset, repeat=6)
for i in res:
md2hasher.update(bytes(i))
strMD2 = md2hasher.hexdigest()
if strMD2.startswith('757c47'):
print i
print strMD2
Sample output:
('a', 'e', 's', '1', 'x', 'e')
757c47bf59afdcd8d05bd4c5d571ef5d
('a', 'i', 'p', '3', 'v', '4')
757c4758262eb9a3ce3a021728f0a842
('a', 'j', '3', 'j', 'p', '3')
757c475ffc257d31026674cb6b346094
Online verification:
http://md5hashing.net/hash/md2/d25e0cd52f62792daff6f76c5a640b4c
(d25e0cd52f62792daff6f76c5a640b4c)
What am i doing wrong?