encrypt method

EncryptedPayload encrypt(
  1. List<int> plaintext
)

Cifra plaintext e retorna EncryptedPayload.

O campo tag do payload é vazio — CTR não produz MAC.

Implementation

EncryptedPayload encrypt(List<int> plaintext) {
  _validate();
  return EncryptedPayload(
    algorithm: CryptAlgorithm.aesCtr,
    ciphertext: Uint8List.fromList(_ctr(plaintext)),
    key: key,
    nonce: initialCounterBlock,
    // tag e aad omitidos → Uint8List(0) por padrão
  );
}