doFinalPartial method

int doFinalPartial(
  1. Uint8List out,
  2. int outOff,
  3. int outLen,
  4. int partialByte,
  5. int partialBits,
)

Implementation

int doFinalPartial(
    Uint8List out, int outOff, int outLen, int partialByte, int partialBits) {
  if (partialBits < 0 || partialBits > 7) {
    throw ArgumentError('partialBits must be in the range [0,7]');
  }

  var finalInput =
      (partialByte & ((1 << partialBits) - 1)) | (0x0F << partialBits);
  var finalBits = partialBits + 4;

  if (finalBits >= 8) {
    absorb(finalInput);
    finalBits -= 8;
    finalInput >>= 8;
  }

  if (finalBits > 0) {
    absorbBits(finalInput, finalBits);
  }

  squeeze(out, outOff, outLen * 8);

  reset();

  return outLen;
}