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

Encrypt a packet&period; Only after Initialize()&period;

== Synopsis

Declared in `&lt;bip324&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
Encrypt(
    std::span&lt;std::byte const&gt; contents,
    std::span&lt;std::byte const&gt; aad,
    bool ignore,
    std::span&lt;std::byte&gt; output) noexcept;
----

== Description

It must hold that output&period;size() &equals;&equals; contents&period;size() &plus; EXPANSION&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *contents*
| The plaintext packet contents to encrypt&period;
| *aad*
| Associated authenticated data covered by the tag but not encrypted&period;
| *ignore*
| Whether to set the ignore bit in the packet header&period;
| *output*
| Output buffer receiving the encrypted packet&period;
|===


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