final
Finalize the hash and write any number of output bytes.
Function parameters
Parameters
- self:*const Blake3
- out_slice:[]u8
An incremental hasher that can accept any number of writes.
Types
- Blake3
- An incremental hasher that can accept any number of writes.
Source
Implementation
pub fn final(self: *const Blake3, out_slice: []u8) void {
// Starting with the Output from the current chunk, compute all the
// parent chaining values along the right edge of the tree, until we
// have the root Output.
var output = self.chunk_state.output();
var parent_nodes_remaining: usize = self.cv_stack_len;
while (parent_nodes_remaining > 0) {
parent_nodes_remaining -= 1;
output = parentOutput(
self.cv_stack[parent_nodes_remaining],
output.chainingValue(),
self.key,
self.flags,
);
}
output.rootOutputBytes(out_slice);
}