applyBlockCipher function

Uint8List? applyBlockCipher(
  1. BlockCipher? cipher,
  2. Uint8List? m
)

Transforms m by cipher provided m.length is a multiple of cipher.blockSize.

Implementation

Uint8List applyBlockCipher(BlockCipher cipher, Uint8List m) {
  Uint8List out = Uint8List(m.length);
  if (m.length % cipher.blockSize != 0) {
    throw FormatException('${m.length} not multiple of ${cipher.blockSize}');
  }
  for (int offset = 0; offset < m.length; offset += cipher.blockSize) {
    cipher.processBlock(m, offset, out, offset);
  }
  return out;
}