State
Supertype for stateful digest handles.
Subtype of Sink. Putting a str
or bin value updates the digest state with its bytes.
Methods
update data
Updates the digest state with the bytes of data.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
str|bin |
Input to hash |
Returns: The same handle, for chaining.
let state = Blake3()
state.update "ab".update b"c"
assert_eq $state.digest().hex()
6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85
let sink = Blake3()
sink.put "ab"
sink.put b"c"
assert_eq $sink.digest() (blake3 "abc")
digest
Returns the current digest bytes without consuming the handle.
Returns: bin - Digest snapshot