Hasher

public protocol Hasher

Protocol for hash algorithm implementations consumed by Hashable.

The contract is the same as Rust / Swift: Hashable-conforming types write their bytes into the hasher; the hasher accumulates state and emits a UInt64 digest on finish(). Used by Set, Dictionary, and any structure that wants stable hashes.

Methods

mutating func finish() -> UInt64

Returns the finalised hash. After calling finish the hasher's state is unspecified — don't reuse it.

mutating func write(ArraySlice[UInt8])

Mixes bytes into the running hash state.

Defined in lang/std/core/protocols.ks