restoreState method

  1. @override
SerializableHash restoreState(
  1. HashState savedState
)
override

Restores the hash computation state from a previously saved state.

This method allows you to restore the hash computation state to a previously saved state. It is useful when you want to continue hashing data from a certain point, or if you want to combine multiple hash computations.

Parameters:

  • savedState: The saved state to restore.

Returns the current instance of the hash algorithm with the restored state.

Implementation

@override
SerializableHash restoreState(HashState savedState) {
  savedState as SHA512State;
  _stateHi.setAll(0, savedState.stateHi);
  _stateLo.setAll(0, savedState.stateLo);
  _bufferLength = savedState.bufferLength;
  if (savedState.buffer != null) {
    _buffer.setAll(0, savedState.buffer!);
  }
  _bytesHashed = savedState.bytesHashed;
  _finished = false;
  return this;
}