ahvn.utils.basic.hash_utils module

Hashing helpers used across AgentHeaven.

ahvn.utils.basic.hash_utils.md5hash(obj, salt=None, sep='||')[源代码]

Generate an MD5 hash for the given object.

参数:
  • 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.

返回:

The MD5 hash as an integer.

返回类型:

int

ahvn.utils.basic.hash_utils.fmt_hash(id)[源代码]

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

参数:

id (int) -- The ID to format.

返回:

The formatted ID string.

返回类型:

str

ahvn.utils.basic.hash_utils.fmt_short_hash(id, length=8)[源代码]

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

参数:
  • id (int) -- The ID to format.

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

返回:

The formatted short hash string.

返回类型:

str