The Python Oracle

Python md5 hashes comparison

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Track title: CC C Schuberts Piano Sonata No 13 D

--

Chapters
00:00 Python Md5 Hashes Comparison
00:32 Accepted Answer Score 3
00:53 Thank you

--

Full question
https://stackoverflow.com/questions/1266...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #hash #md5

#avk47



ACCEPTED ANSWER

Score 3


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')