baml.hash.Hasher

An incremental consumer of hash input.

Reference version

Signature

interface baml.hash.Hasher

An incremental consumer of hash input.

Implementations may choose their own algorithm. This does not configure the hashing algorithm used by maps.

Source:<builtin>/baml/ns_hash/hash.bamlbytes 163–661

Required instance methods

function

write

(self, bytes: uint8array) -> null throws never

Appends bytes to the input stream.

Writing a stream in chunks must have the same result as writing its concatenation. Hash implementations provide value boundaries.

function

finish

(self) -> int throws never

Returns the signed hash of the input so far, without resetting the state.

Repeated calls without intervening writes return the same value.