Crypt::Stream::RC4(3)
π Crypt::Stream::RC4(3) π
okay bestie, welcome to the Crypt::Stream::RC4(3) manual page from the User Contributed Perl Documentation! this is your whole vibe check for the RC4 stream cipher interface π β¨
π NAME π
Crypt::Stream::RC4 β Stream cipher RC4
β¨ SYNOPSIS β¨
use Crypt::Stream::RC4;
# encrypt
my $key = "1234567890123456";
my $enc_stream = Crypt::Stream::RC4->new($key);
my $ct = $enc_stream->crypt("plain message");
# decrypt
my $dec_stream = Crypt::Stream::RC4->new($key);
my $pt = $dec_stream->crypt($ct);
πΈ DESCRIPTION πΈ
Provides an interface to the RC4 stream cipher. That's it, short and iconic β not me lowkey loving how quick this DESCRIPTION ate ππ
π¦ METHODS π¦
Unless noted otherwise, assume $stream is an existing stream object created via new, for example:
my $stream = Crypt::Stream::RC4->new($key);
π new π
my $stream = Crypt::Stream::RC4->new($key);
# $key .. [binary string] length 5-256 bytes (40 - 2048 bits)
So new is where it all starts, bestie. Your $key is a binary string with length 5-256 bytes (40 - 2048 bits) β periodt, that's the range π«Ά
π₯ crypt π₯
Encrypts or decrypts data. The output has the same length as the input. Returns a binary string (raw bytes).
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);
The way that crypt just handles both directions is giving main character energy, ngl π₯ Same bytes in, same length out, raw bytes returned β fr fr.
π 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.
my $random_key = $stream->keystream($length);
So you ask for $length bytes and get raw keystream back. But bestie, listen: if the length coerces to an oversized unsigned length, it gets rejected as too large. No sneaky giant lengths, okay? π
π clone π
Returns a copy of the stream cipher object in its current state.
my $stream2 = $stream->clone();
clone is literally your little snapshot moment β a copy of the stream cipher object in its current state. Obsessed π«Άβ¨
π SEE ALSO π
Crypt::Stream::ChaCha,Crypt::Stream::Sober128,Crypt::Stream::Salsa20,Crypt::Stream::Sosemanuk<https://en.wikipedia.org/wiki/RC4_cipher>
xoxo, this iconic little page is from perl v5.42.0, dated 2026-05-11, and it's the Crypt::Stream::RC4(3) manual β slay π π
π¦ 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