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
Implements the Hashable trait and hash() built-in function.
There are a few main tools in this module:
Hashabletrait for types implementing__hash__(self, mut hasher)hash[T: Hashable](hashable: T) -> UInt64built-in function.hash_bytes(bytes: ImmSpan[Byte]) -> UInt64for arbitrary byte strings, is the workhorse function, which implements efficient hashing via SIMD vectors. See the documentation of this function for more details on the hash implementation.hash(SIMD)andhash(UInt8)implementations These are useful helpers to specialize for the general bytes implementation.
Traits
-
Hashable: A trait for types which specify a function to hash their data.
Functions
-
hash: Hash a Hashable type using its underlying hash implementation. -
hash_bytes: Hash a sequence of bytes using the specified hasher.