Skip to main content

module

hash

Implements the Hashable trait and hash() built-in function.

There are a few main tools in this module:

  • Hashable trait for types implementing __hash__(self) -> Int
  • hash[T: Hashable](hashable: T) -> Int built-in function.
  • A hash() implementation for abritrary byte strings, hash(data: DTypePointer[DType.int8], n: Int) -> Int, 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) and hash(Int8) 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.