addPadding method

  1. @override
int addPadding(
  1. Uint8List data,
  2. int offset
)
override

Add the pad bytes to the passed in block, returning the number of bytes added.

Note: this assumes that the last block of plain text is always passed to it inside data. i.e. if offset is zero, indicating the entire block is to be overwritten with padding the value of data should be the same as the last block of plain text. The reason for this is that some modes such as 'trailing bit compliment' base the padding on the last byte of plain text.

Implementation

@override
int addPadding(Uint8List data, int offset) {
  int added = (data.length - offset);
  while (offset < data.length) {
    data[offset] = 0;
    offset++;
  }
  return added;
}