Skip to content

State

Incremental BLAKE2b hash state; created via generichash.new(). Feed data incrementally with update, then call final exactly once to retrieve the digest. Always call final - the internal FFI buffer cannot be reclaimed by the GC if it is skipped, even when all references to the State are dropped.

State.statePointer  :: FFIPointer
State.outputBytes  :: number
State.finalized  :: boolean
State : update ( chunk )  -> ()

Feeds chunk into the hash state. May be called any number of times before final. Errors if called after final.

Parameters

chunk: buffer
State : final ( )  -> buffer

Finalises the hash and returns the digest. Frees the internal state buffer. Errors if called more than once on the same State.

Returns

buffer
State . new ( outputBytes key )  -> State

Parameters

outputBytes: number?
key: buffer?

Returns

State