So here I'm generating random hex values, hashing them and comparing to a pre-given hash. The program tests about 4 000 hashes and then just stops running without an error.
Here's the loop part of the code:
randomhex = binascii.b2a_hex(os.urandom(4))
hash_object = hashlib.sha1(randomhex)
hashh = hash_object.hexdigest()
if hashh == sha: