hash | Modular

Mojo function

hash[T: Hashable, HasherType: Hasher = default_hasher](hashable: T) -> UInt64

Hash a Hashable type using its underlying hash implementation.

Parameters:

  • T (Hashable): Any Hashable type.
  • HasherType (Hasher): Type of the hasher which should be used for hashing.

Args:

  • hashable (T): The input data to hash.

Returns:

UInt64: A 64-bit integer hash based on the underlying implementation.

hash[HasherType: Hasher = default_hasher](bytes: UnsafePointer[UInt8, bytes.origin], n: Int) -> UInt64

Hash a sequence of bytes using the specified hasher.

Parameters:

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

Args:

  • bytes (UnsafePointer): Pointer to the byte sequence to hash.
  • n (Int): The number of bytes to hash.

Returns:

UInt64: A 64-bit integer hash value.