[#AEADChaCha20Poly1305-Encrypt-07]
= xref:AEADChaCha20Poly1305.adoc[AEADChaCha20Poly1305]::Encrypt
:relfileprefix: ../
:mrdocs:

Encrypt a message with a specified 96&hyphen;bit nonce and aad&period;

== Synopsis

Declared in `&lt;crypto&sol;chacha20poly1305&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
Encrypt(
    std::span&lt;std::byte const&gt; plain,
    std::span&lt;std::byte const&gt; aad,
    xref:AEADChaCha20Poly1305/Nonce96.adoc[Nonce96] nonce,
    std::span&lt;std::byte&gt; cipher) noexcept;
----

== Description

Requires cipher&period;size() &equals; plain&period;size() &plus; EXPANSION&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *plain*
| The plaintext to encrypt&period;
| *aad*
| The associated data to authenticate but not encrypt&period;
| *nonce*
| The 96&hyphen;bit nonce&period;
| *cipher*
| Output buffer receiving the ciphertext and authentication tag&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
