Crypt::...Sober128(3)

πŸ’– NAME πŸ’–

Crypt::Stream::Sober128 - Stream cipher Sober128

Okay bestie, welcome to the manual page for Crypt::...Sober128(3) β€” yep, from the User Contributed Perl Documentation β€” and the whole thing is about Crypt::Stream::Sober128, aka the Stream cipher Sober128. Slay. ✨


✨ SYNOPSIS ✨

Here's the whole encrypt/decrypt vibe in one little block, no cap:

use Crypt::Stream::Sober128;

# encrypt
my $key = "1234567890123456";
my $iv  = "123456789012";
my $enc_stream = Crypt::Stream::Sober128->new($key, $iv);
my $ct = $enc_stream->crypt("plain message");

# decrypt
my $dec_stream = Crypt::Stream::Sober128->new($key, $iv);
my $pt = $dec_stream->crypt($ct);

πŸ¦‹ DESCRIPTION πŸ¦‹

This module gives you an interface to the Sober128 stream cipher. That's the description, and honestly? Iconic brevity. πŸ’…


🧚 METHODS 🧚

Unless noted otherwise, assume $stream is an existing stream object created via new β€” like this, bestie:

my $stream = Crypt::Stream::Sober128->new($key, $iv);

πŸŽ€ new πŸŽ€

Makes a shiny new stream object. Signature time:

my $stream = Crypt::Stream::Sober128->new($key, $iv);
# $key .. [binary string] keylen must be multiple of 4 bytes
# $iv  .. [binary string] ivlen must be multiple of 4 bytes

So: $key is a binary string and keylen must be a multiple of 4 bytes. $iv is a binary string and ivlen must be a multiple of 4 bytes. That's the vibe check. 🫢

πŸ’… crypt πŸ’…

crypt encrypts or decrypts data. The output has the same length as the input, and it returns a binary string (raw bytes). Periodt.

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. Perl's coercion is literally doing its thing. 😭

my $ciphertext = $stream->crypt($plaintext);
#or
my $plaintext = $stream->crypt($ciphertext);

πŸ¦‹ keystream πŸ¦‹

Returns $length bytes of raw keystream as a binary string. Chef's kiss.

The length is taken using Perl's usual numeric coercion. Values that coerce to an oversized unsigned length are rejected as too large. No sneaky giant keystream, just a firm no. πŸ’€

my $random_key = $stream->keystream($length);

⭐ clone ⭐

Returns a copy of the stream cipher object in its current state. Clone the vibe, bestie. 🫢

my $stream2 = $stream->clone();

🌈 SEE ALSO 🌈

Go check out these other icons:

And that's the whole page, bestie πŸ’– β€” this gem is from perl v5.42.0, dated 2026-05-11, and it's the Crypt::...Sober128(3) manual page. Byeeee πŸŽ€

πŸ“¦ where this page comes from