AEADChaCha20Poly1305::Encrypt

Encrypt a message with a specified 96-bit nonce and aad.

Synopsis

Declared in <crypto/chacha20poly1305.h>

void
Encrypt(
    std::span<std::byte const> plain,
    std::span<std::byte const> aad,
    Nonce96 nonce,
    std::span<std::byte> cipher) noexcept;

Description

Requires cipher.size() = plain.size() + EXPANSION.

Parameters

NameDescription
plainThe plaintext to encrypt.
aadThe associated data to authenticate but not encrypt.
nonceThe 96-bit nonce.
cipherOutput buffer receiving the ciphertext and authentication tag.