ahvn.utils.basic.hash_utils module¶

Hashing helpers used across AgentHeaven.

ahvn.utils.basic.hash_utils.md5hash(obj, salt=None, sep='||')[source]¶

Generate an MD5 hash for the given object.

Parameters:
  • obj (Any) – The object to hash.

  • salt (Any, optional) – An optional salt to add to the hash.

  • sep (str, optional) – Separator for concatenating serialized parts.

Returns:

The MD5 hash as an integer.

Return type:

int

ahvn.utils.basic.hash_utils.fmt_hash(id)[source]¶

Format an md5hash ID integer as a zero-padded string.

Parameters:

id (int) – The ID to format.

Returns:

The formatted ID string.

Return type:

str

ahvn.utils.basic.hash_utils.fmt_short_hash(id, length=8)[source]¶

Format an md5hash ID integer as a short zero-padded string.

Parameters:
  • id (int) – The ID to format.

  • length (int, optional) – The length of the short hash string.

Returns:

The formatted short hash string.

Return type:

str