hash#
Source code: sensai/util/hash.py
- pickle_hash(o: Any, algorithm='sha1', with_class_name=False) str [source]#
Computes a deterministic hash code based on the contents of the given object
- Parameters:
o – any picklable object
algorithm – the name of a hashing algorithm supported by hashlib
with_class_name – if True, prepend o’s class name to the returned hex string
- Returns:
the object’s hash code as a hex string
- str_hash(o: Any, algorithm='sha1', with_class_name=False) str [source]#
Computes a deterministic hash code based on the string representation of the given object
- Parameters:
o – any object
algorithm – the name of a hashing algorithm supported by hashlib
with_class_name – if True, prepend o’s class name to the returned hex string
- Returns:
the object’s hash code as a hex string