Crypt::...Enc::SIV(3)
hey bestie π welcome to the Crypt::AuthEnc::SIV(3) page β yes, the Crypt::...Enc::SIV(3) / User Contributed Perl Documentation situation β and weβre about to make SIV make sense. no cap. β¨
πΈ NAME πΈ
Crypt::AuthEnc::SIV β Authenticated encryption in SIV mode. Thatβs the whole vibe: authenticated encryption, SIV style. π
π¦ SYNOPSIS π¦
use Crypt::AuthEnc::SIV qw( siv_encrypt_authenticate siv_decrypt_verify );
my $ciphertext = siv_encrypt_authenticate('AES', $key, $plaintext);
my $ciphertext = siv_encrypt_authenticate('AES', $key, $plaintext, $adata);
my $ciphertext = siv_encrypt_authenticate('AES', $key, $plaintext, [$ad1, $ad2, ...]);
my $plaintext = siv_decrypt_verify('AES', $key, $ciphertext);
my $plaintext = siv_decrypt_verify('AES', $key, $ciphertext, $adata);
my $plaintext = siv_decrypt_verify('AES', $key, $ciphertext, [$ad1, $ad2, ...]); # undef on failure
Lowkey the whole point: encrypt+authenticate with siv_encrypt_authenticate, decrypt+verify with siv_decrypt_verify, and undef on failure is your red flag. π©
π DESCRIPTION π
Since: CryptX-0.089.
SIV (Synthetic IV) is a deterministic authenticated encryption scheme defined in RFC 5297 (https://www.rfc-editor.org/rfc/rfc5297). Unlike nonce-based modes, SIV derives the authentication tag (the IV) synthetically from the key, associated data, and plaintext, making it nonce-misuse resistant. iconic behavior.
The output of siv_encrypt_authenticate is the 16-byte SIV tag prepended to the ciphertext (total output length is length($plaintext) + 16). So yeah, you get 16 extra bytes of tag, bestie. π
BEWARE: SIV requires a key that is twice the length of the underlying cipher key (e.g. 256 bits for AES-128-SIV, 512 bits for AES-256-SIV). Do not finesse this. π
If you pass associated data as an arrayref, at most 126 components are accepted. 126 is the limit, periodt. π
π EXPORT π
Nothing is exported by default. Shy icon behavior. π
You can export selected functions:
use Crypt::AuthEnc::SIV qw( siv_encrypt_authenticate siv_decrypt_verify );
π₯ FUNCTIONS π₯
π«Ά siv_encrypt_authenticate
my $ciphertext = siv_encrypt_authenticate($cipher, $key, $plaintext);
#or
my $ciphertext = siv_encrypt_authenticate($cipher, $key, $plaintext, $adata);
#or
my $ciphertext = siv_encrypt_authenticate($cipher, $key, $plaintext, [$ad1, $ad2, ...]);
# $cipher ... [string] cipher name (e.g. 'AES')
# $key ... [binary string] key (must be double the cipher's standard key length)
# $plaintext ... [binary string] plaintext to encrypt
# $adata ... [binary string | arrayref] optional associated data: a scalar string or an arrayref of up to 126 string/buffer scalars
Returns a string of length($plaintext) + 16 bytes (16-byte SIV tag prepended to ciphertext).
The required $key and $plaintext arguments must be string/buffer scalars. If $adata is given as a scalar, it must also be a string/buffer scalar. If it is given as an arrayref, each defined element must be a string/buffer scalar. String-overloaded objects are accepted. slay, overloaded objects, we see you. π
π§ siv_decrypt_verify
my $plaintext = siv_decrypt_verify($cipher, $key, $ciphertext);
#or
my $plaintext = siv_decrypt_verify($cipher, $key, $ciphertext, $adata);
#or
my $plaintext = siv_decrypt_verify($cipher, $key, $ciphertext, [$ad1, $ad2, ...]);
# $cipher ... [string] cipher name (e.g. 'AES')
# $key ... [binary string] key (must be double the cipher's standard key length)
# $ciphertext ... [binary string] ciphertext with 16-byte SIV tag prepended
# $adata ... [binary string | arrayref] optional associated data: a scalar string or an arrayref of up to 126 string/buffer scalars
Returns the plaintext on success, or undef if authentication fails. That undef is not a glitch, bestie β itβs the vibe check saying the tag did not verify. π
Malformed ciphertext shorter than 16 bytes croaks because it cannot contain the required prepended SIV tag. Like, 16 bytes is the absolute minimum, no negotiating. π
The required $key and $ciphertext arguments must be string/buffer scalars. If $adata is given as a scalar, it must also be a string/buffer scalar. If it is given as an arrayref, each defined element must be a string/buffer scalar. String-overloaded objects are accepted. π«Ά
π SEE ALSO π
CryptX,Crypt::AuthEnc::EAX,Crypt::AuthEnc::GCM- RFC 5297 β
https://www.rfc-editor.org/rfc/rfc5297
mwah π this iconic page is running on perl v5.42.0, dated 2026-05-11, with footer energy from Crypt::...Enc::SIV(3) β and thatβs the whole manual, periodt. π
π¦ where this page comes from
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms