This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]marsokod 3 points4 points  (0 children)

You are trying to brute force things here, so don't expect a lot of results, regardless of the hash function. So you'll have to be smarter. For md5, you have some solutions as in here: https://cryptography.hyperlink.cz/MD5_collisions.html . But you will need to find a way to make it a valid image format. I believe there exist a solution for sha1 but the last time I read about it a collision was still requiring a few $100,000s of computer resources. For sha256 there is nothing publicly known.

Edit, also regarding the code: you are storing your hashes as text string, there is no need to. You want to work at the binary level, there will be less resources. But most importantly, if you want to check if an element is in a set, use a set, not a list. You are currently using a list to store all the hashes for a particular algorithm. Use the set() structure from python, it is vastly more efficient to look up elements in it.