secretbox

High-level symmetric authenticated encryption.

ubyte[]
secretbox
@safe nothrow
(
in ubyte[] msg
,
in ubyte[] nonce
,
in ubyte[] key
)
in { assert (key.length == key_bytes, "Invalid key length."); assert (nonce.length == nonce_bytes, "Invalid nonce length."); }

Parameters

msg
Type: ubyte[]

Plaintext message.

nonce
Type: ubyte[]

24 bytes used once per key.

key
Type: ubyte[]

Secret shared key. 32 bytes.

Return Value

Type: ubyte[]

Authentication tag and encrypted message. The output is 16 bytes longer than the input.

Meta