py_research.hashing module#

Utilities for producing hashes of common objects.

gen_int_hash(obj)[source]#

Generate stable hash for obj (must be known, hashable or composed of such).

Parameters:

obj (Any) –

Return type:

int

gen_str_hash(x, length=10)[source]#

Generate stable hash for obj (must be known, hashable or composed of such).

Parameters:
  • x (Any) – Object to hash.

  • length (int) – Length of the hash.

  • raw_str – Whether to use the raw string representation of the object, if it is a string.

Returns:

Hash of the object as string.

Return type:

str