processBlock method

  1. @override
int processBlock(
  1. Uint8List input,
  2. int inOff,
  3. Uint8List output,
  4. int outOff,
)
override

Process a whole block of data given by inp and starting at offset inpOff.

The resulting cipher text is put in out beginning at position outOff.

This method returns the total bytes processed (which is the same as the block size of the algorithm).

Implementation

@override
int processBlock(
  final Uint8List input,
  final int inOff,
  final Uint8List output,
  final int outOff,
) {
  if (_workingKey.isEmpty) {
    throw StateError('$algorithmName not initialised');
  }
  if ((inOff + BLOCK_SIZE) > input.lengthInBytes) {
    throw ArgumentError('Input buffer too short for $algorithmName engine');
  }
  if ((outOff + BLOCK_SIZE) > output.lengthInBytes) {
    throw ArgumentError('Output buffer too short for $algorithmName engine');
  }

  if (_forEncryption) {
    _encryptBlock(input, inOff, output, outOff);
  } else {
    _decryptBlock(input, inOff, output, outOff);
  }

  return BLOCK_SIZE;
}