scrachy.utils.hash.hash_text

scrachy.utils.hash.hash_text(hash_fn: Hasher, text: str | Sequence[str] | None = None) bytes[source]

Hash a string, or list of strings, using the given hash_fn. If any string is None, it will return the hash value of an empty string.

Parameters:
  • text – The string to hash.

  • hash_fn – A hash function object that adheres to the hashlib API. Namely, it must have an update function and a digest function.

Returns:

The hash digest as an array of bytes.