I'm trying to compare hashes using Python, but I'm stuck with this problem:
print ('-- '+hashesFile[h])
print ('-> ' +hashlib.md5(wordsFile[j]).hexdigest())
-- 5d21e42d34fc1563bb2c73b3e1811357
-> 5d21e42d34fc1563bb2c73b3e1811357
But this comparison is never true:
if (hashesFile[h] == hashlib.md5(wordsFile[j]).hexdigest()):
print ('ok')
I searched for a solution and tried to encode the string before compare them, but is don't work anyway.
Cheers!!
try to print both as:
print '-- %r' % hashesFile[h]
print '-> %r' % hashlib.md5(wordsFile[j]).hexdigest())
then you'll see whats really inside.
I suppose that this will work for you:
if (hashesFile[h].strip() == hashlib.md5(wordsFile[j]).hexdigest()):
print ('ok')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With