reset method

void reset()

Resets the hash to its initial state, effectively clearing all values added via update().

Implementation

void reset() {
  final keyLength = (key == null) ? 0 : key!.length;

  final hash = List<int>.filled(8, 0);

  for (var i = 0; i < hash.length; i++) {
    hash[i] = iv![i];
    if (salt != null) hash[i] ^= salt![i];
    if (personalization != null) hash[i] ^= personalization![i];
  }

  final block = List<int>.filled(_blockSize, 0);

  if (bitLength == 32) {
    _hash = Uint32List.fromList(hash);
    _block = Uint32List.fromList(block);
  } else {
    _hash = Uint64List.fromList(hash);
    _block = Uint64List.fromList(block);
  }

  // If [key] exists, make the first round with it.
  if (keyLength > 0) {
    update(key!);
    _pointer = _blockSize;
  }
}