The Python Oracle

Python md5 hashes comparison

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Quiet Intelligence

--

Chapters
00:00 Question
00:43 Accepted answer (Score 3)
01:03 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')