encrypt method

Uint8List encrypt(
  1. List<int> iv,
  2. List<int> plaintext
)

Encrypts plaintext in one call. For CTR the output has the same length.

Implementation

Uint8List encrypt(List<int> iv, List<int> plaintext) {
  final s = encryptStream(iv);
  final out = BytesBuilder(copy: false)
    ..add(s.update(plaintext))
    ..add(s.finish());
  return out.takeBytes();
}