Skip to main content

Hash

Type Hash

type Hash = Nat32

Hash values represent a string of hash bits, packed into a Nat32.

Value length

let length : Nat

The hash length, always 31.

Function bit

func bit(h : Hash, pos : Nat) : Bool

Project a given bit from the bit vector.

Function equal

func equal(ha : Hash, hb : Hash) : Bool

Test if two hashes are equal.

Function hash

func hash(n : Nat) : Hash
[Deprecated function]

This function computes a hash from the least significant 32 bits of n, ignoring other bits. For large Nat values, consider using a bespoke hash function that considers all of the argument's bits.

Function debugPrintBits

func debugPrintBits(bits : Hash)
[Deprecated function]

This function will be removed in a future version.

Function debugPrintBitsRev

func debugPrintBitsRev(bits : Hash)
[Deprecated function]

This function will be removed in a future version.

Function hashNat8

func hashNat8(key : [Hash]) : Hash

View Jenkin's one at a time.

The input type should actually be [Nat8]. Be sure to explode each Nat8 of a Nat32 into its own Nat32, and shift into the lower 8 bits.

[Deprecated function]

This function may be removed or changed in a future version.