reset method

  1. @override
BLAKE2b reset()
override

Resets the BLAKE2b hash instance to its initial state, clearing all internal data.

This method restores the initial state of the hash function, including the hash state, the buffer, counters, and flags. If a key was previously set, it will be put back into the buffer.

Returns:

  • The modified BLAKE2b instance, now in its initial state.

Implementation

@override
BLAKE2b reset() {
  _state.setAll(0, _initialState);

  if (_paddedKey != null) {
    _buffer.setAll(0, _paddedKey!);
    _bufferLength = _blockSize;
  } else {
    _bufferLength = 0;
  }

  zero(_ctr);
  zero(_flag);
  _finished = false;

  return this;
}