finish method
Finalizes the BLAKE2b hash, producing the hash digest and writing it to the given output.
Parameters:
out: The hash digest will be written.
Implementation
@override
BLAKE2b finish(List<int> out) {
if (!_finished) {
for (int i = _bufferLength; i < _blockSize; i++) {
_buffer[i] = 0;
}
// Set last block flag.
_flag[0] = BinaryOps.mask32;
_flag[1] = BinaryOps.mask32;
// Set last node flag if the last node in the tree.
if (_lastNode) {
_flag[2] = BinaryOps.mask32;
_flag[3] = BinaryOps.mask32;
}
_processBlock(_bufferLength);
_finished = true;
}
final List<int> tmp = List<int>.filled(64, 0);
for (int i = 0; i < 16; i++) {
BinaryOps.writeUint32LE(_state[i], tmp, i * 4);
}
out.setRange(0, out.length, tmp);
return this;
}