The Python Oracle

Python md5 hashes comparison

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping

--

Chapters
00:00 Python Md5 Hashes Comparison
00:30 Accepted Answer Score 3
00:45 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')