Crypt::...Salsa20(3)
π NAME π
okay bestie, this page is Crypt::...Salsa20(3) from User Contributed Perl Documentation, and the icon of the whole thing is Crypt::Stream::Salsa20 β Stream cipher Salsa20, periodt. π
β¨ SYNOPSIS β¨
use Crypt::Stream::Salsa20;
# encrypt
my $key = "1234567890123456";
my $nonce = "12345678";
my $enc_stream = Crypt::Stream::Salsa20->new($key, $nonce);
my $ct = $enc_stream->crypt("plain message");
# decrypt
my $dec_stream = Crypt::Stream::Salsa20->new($key, $nonce);
my $pt = $dec_stream->crypt($ct);
π¦ DESCRIPTION π¦
lowkey the whole point: this module provides an interface to the Salsa20 stream cipher. that's the vibe, no cap. π
π METHODS π
unless noted otherwise, assume $stream is an existing stream object created via new, for example:
my $stream = Crypt::Stream::Salsa20->new($key, $nonce);
πΈ new πΈ
new is your main character constructor β it makes the stream object. you can call it with just key and nonce, or with counter and rounds too:
my $stream = Crypt::Stream::Salsa20->new($key, $nonce);
#or
my $stream = Crypt::Stream::Salsa20->new($key, $nonce, $counter, $rounds);
# $key .. [binary string] 32 or 16 bytes
# $nonce .. [binary string] 8 bytes
# $counter .. [integer] initial counter value (DEFAULT: 0)
# $rounds .. [integer] rounds (DEFAULT: 20)
also, so it's crystal clear:
$keyβ[binary string]32 or 16 bytes π$nonceβ[binary string]8 bytes β¨$counterβ[integer]initial counter value (DEFAULT:0) π$roundsβ[integer]rounds (DEFAULT:20) π¦
π₯ crypt π₯
crypt encrypts or decrypts data. the output has the same length as the input, and it returns a binary string (raw bytes). literally matching energy. π
the input is converted using Perl's usual scalar stringification. passing undef is treated as an empty string with the usual warning, and numeric scalars are stringified before processing.
my $ciphertext = $stream->crypt($plaintext);
#or
my $plaintext = $stream->crypt($ciphertext);
π« keystream π«
returns $length bytes of raw keystream as a binary string.
the length is taken using Perl's usual numeric coercion. values that coerce to an oversized unsigned length are rejected as too large β so no cursed giant-length shenanigans, bestie π
my $random_key = $stream->keystream($length);
π§ clone π§
returns a copy of the stream cipher object in its current state. it's giving save-point energy, honestly. β¨
my $stream2 = $stream->clone();
π SEE ALSO π
Crypt::Stream::ChaCha,Crypt::Stream::RC4,Crypt::Stream::Sober128,Crypt::Stream::Sosemanukπ<https://cr.yp.to/snuffle/spec.pdf>π«Ά
that's the page, bestie π
this was Crypt::...Salsa20(3) from User Contributed Perl Documentation, served with perl v5.42.0 and dated 2026-05-11 β bye and stay encrypted π
π¦ 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