Python has a builtin hash function for getting a hash of objects. The digest seems to be only 64 bits, so it's very prone to collision. Is there a way to use a more secure hash function on objects?
python has a builtin hashlib library, but it doesn't work on objects the way the hash() function does. Is there a way to encode a class the way the builtin hash function does?
import hashlib
class hashme:
a=33
b=22
hasher=hashlib.sha256()
# declare a class
myclass=hashme()
# the normal python hash function works
print(hex(hash(myclass)))
# other hash functions don't work. This will raise an error.
print(hasher.update(myclass))