paddingLength method

int paddingLength(
  1. int blockLength,
  2. int dataLength
)

Computes padding length.

Implementation

int paddingLength(int blockLength, int dataLength) {
  if (blockLength < 2 || blockLength > 0xFF) {
    throw ArgumentError.value(
      blockLength,
      'blockLength',
      'Must be between 2 and 255',
    );
  }
  if (dataLength < 0) {
    throw ArgumentError.value(dataLength, 'dataLength');
  }
  return blockLength - dataLength % blockLength;
}