pad method

Uint8List pad(
  1. int blockSize,
  2. Iterable<int> input
)
override

Implementation

Uint8List pad(int blockSize, Iterable<int> input) {
  int numBlocks = (input.length / (blockSize - 11)).ceil();
  final output = Uint8List(numBlocks * blockSize);

  for (int i = 0; i < numBlocks; i++) {
    Iterable<int> block;
    if (i == numBlocks - 1) {
      block = input;
    } else {
      block = input.take(blockSize - 11);
      input = input.skip(blockSize - 11);
    }
    padBlock(
        blockSize, block, output.buffer.asByteData(i * blockSize, blockSize));
  }

  return output;
}