absorbRange method

void absorbRange(
  1. Uint8List data,
  2. int off,
  3. int len
)
inherited

Implementation

void absorbRange(Uint8List data, int off, int len) {
  if ((_bitsInQueue % 8) != 0) {
    throw StateError('attempt to absorb with odd length queue');
  }
  if (squeezing) {
    throw StateError('attempt to absorb while squeezing');
  }

  var bytesInQueue = _bitsInQueue >> 3;
  var rateBytes = _rate >> 3;

  var available = rateBytes - bytesInQueue;
  if (len < available) {
    _dataQueue.setRange(bytesInQueue, bytesInQueue + len, data, off);
    _bitsInQueue += len << 3;
    return;
  }

  var count = 0;
  if (bytesInQueue > 0) {
    _dataQueue.setRange(
        bytesInQueue, bytesInQueue + available, data.sublist(off));
    count += available;
    _keccakAbsorb(_dataQueue, 0);
  }

  int remaining;
  while ((remaining = len - count) >= rateBytes) {
    _keccakAbsorb(data, off + count);
    count += rateBytes;
  }

  _dataQueue.setRange(0, remaining, data, off + count);
  _bitsInQueue = remaining << 3;
}