12345678module juptune.crypto.aead;
Result encrypt(
SecureMemory. plaintext,
ubyte[] additionalData,
ubyte[] outCipherText,
ubyte[] outCipherTextSlice
);
Encrypts the given plaintextinto the outCipherTextbuffer, using the given additionalDatato calculate the authentication tag, and returns a slice outCipherTextwhich contains the final encrypted ciphertext + authentication tag.
plaintextmust not be empty, it makes no sense to encrypt an empty buffer.
outCipherTextmust be at least plaintext.length + AeadAlgorithmT.ABYTESin length. Where ABYTES is typically the length of the authentication tag.
This is a "combined" AEAD encryption, where the authentication tag is appended to the ciphertext. You can retrieve the tag by taking the last AeadAlgorithmT.ABYTESbytes of outCipherTextSlice.
Anything that AeadAlgorithmT.encryptthrows.
A Resultthat indicates if the encryption was successful or not.