saveState method

  1. @override
Blake2bState saveState()
override

Saves the current state of the BLAKE2b hash function for future restoration.

Throws:

  • CryptoException if the hash function has already been marked as finished.

Implementation

@override
Blake2bState saveState() {
  if (_finished) {
    throw CryptoException.failed(
      "BLAKE2b.saveState",
      reason: "State was finished.",
    );
  }

  return Blake2bState(
    state: List<int>.from(_state, growable: false),
    buffer: List<int>.from(_buffer, growable: false),
    bufferLength: _bufferLength,
    ctr: List<int>.from(_ctr, growable: false),
    flag: List<int>.from(_flag, growable: false),
    lastNode: _lastNode,
    paddedKey: _paddedKey != null ? List<int>.from(_paddedKey!) : null,
    initialState: List<int>.from(_initialState, growable: false),
  );
}