Skip to content

Tag: hash

Why is hash of nan zero?

I would have thought would lead to frequent hash collisions. Why are they both hashed to zero? Answer This behaviour has changed in Python 3.10: Hashes of NaN values of both float type and decimal.Decimal type now depend on object identity. Formerly, they always hashed to 0 even though NaN values are not equal to one another. This caused potentially

Ignore image name while getting hash

I’m coding a program which’ll take an image for an input, check it against images in a database and output the image with the same hash However, when using hash(“imagepath”) 2 of the same images give different hashes, even when the only difference is the image’s name, which makes me believe the name is the issue Is there a way

Check if files in dir are the same

I have a folder of 5000+ images in jpeg/png etc. How can I check if any of the images are the same. The images were collected through web scraping and have been sequentially renamed so I cannot compare file names. I am currently checking if the hashes are the same however this is a very long process. I am currently

Comparing Python Hashes

I want to compare a hash of my password to a hash of what the user typed in, with (str)(hashlib.md5(pw.encode(‘utf-8′)).hexdigest()). The hash of the password is b’¥_ÆMÐ1;2±*öªÝ=’. However, when I run …

Fast hash for strings

I have a set of ASCII strings, let’s say they are file paths. They could be both short and quite long. I’m looking for an algorithm that could calculate hash of such a strings and this hash will be …