IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

hash_bytes

def hash_bytes[HasherType: Hasher = AHasher[SIMD[.uint64, 4](0)]](bytes: Span[UInt8]) -> UInt64

Hash a sequence of bytes using the specified hasher.

This hashes bytes as a flat byte sequence. It is distinct from hash(), which hashes a Hashable value: a Span, List or Array is itself Hashable, so hash(collection) hashes it element-by-element and produces a different value.

Parameters:

  • ​HasherType (Hasher): Type of the hasher to use for hashing (default: AHasher).

Args:

Returns:

UInt64: A 64-bit integer hash value.