Crypt::...::Rabbit(3)

πŸ’– NAME πŸ’–

Crypt::Stream::Rabbit β€” Stream cipher Rabbit. Also hiiii, you're on the Crypt::...::Rabbit(3) page from User Contributed Perl Documentation, and we are gonna get you comfy with it 🫢✨

🌈 SYNOPSIS 🌈

use Crypt::Stream::Rabbit;

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

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

πŸ‡ DESCRIPTION πŸ‡

This gives you an interface to the Rabbit stream cipher. That's the whole vibe of the module, bestie β€” it's the Rabbit stream cipher hookup πŸ’œ.

✨ METHODS ✨

Unless a method says otherwise, assume $stream is an existing stream object created via new, like:

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

new β€” constructor o'clock 🐰

my $stream = Crypt::Stream::Rabbit->new($key, $iv);
# $key .. [binary string] key length must be at most 16 bytes
# $iv  .. [binary string] IV length must be at most 8 bytes

my $stream = Crypt::Stream::Rabbit->new($key);
# note: new($key) skips IV setup entirely, while new($key, "") performs
#       IV setup with a zero-length IV. These produce different keystreams.

Okay so $key is a binary string and its length must be at most 16 bytes; $iv is also a binary string and its length must be at most 8 bytes. And the little note above is highkey important: new($key) skips IV setup entirely, while new($key, "") performs IV setup with a zero-length IV β€” and those produce different keystreams, no cap 😭.

crypt β€” encrypt/decrypt era πŸ”

Encrypts or decrypts data. The output has the same length as the input. Returns a binary string (raw bytes) β€” very "here are your raw bytes, bestie" πŸ’….

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 β€” gimme bytes πŸŒ€

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 don't be out here trying to manifest a giant unsigned length, it's not gonna slay πŸ’€.

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

clone β€” duplicate the vibe 🧬

Returns a copy of the stream cipher object in its current state.

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

πŸ‘€ SEE ALSO πŸ‘€


mwah πŸ’‹ β€” this page is signed perl v5.42.0, dated 2026-05-11, and filed under Crypt::...::Rabbit(3). bye bestie, go encrypt something cute βœ¨πŸ’–

πŸ“¦ where this page comes from