Function final [src]
Finalize the hash and write any number of output bytes.
Prototype
pub fn final(self: *const Blake3, out_slice: []u8) void
Parameters
self: *const Blake3
out_slice: []u8
Source
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);
}