Crypt::PRNG::RC4(3)
π NAME π
Crypt::PRNG::RC4 β legacy RC4-based PRNG wrapper π
Hii bestie! This is the Crypt::PRNG::RC4(3) page from the User Contributed Perl Documentation, and yes, the manual name is folded right in here like a little name tag. It's a wrapper, it's RC4-based, and it is legacy β we'll get to that.
β¨ SYNOPSIS β¨
Okay so here's the whole interface menu β functional first, then OO. Copy these exactly, bestie:
### Functional interface:
use Crypt::PRNG::RC4 qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand);
my $octets = random_bytes(45);
my $hex_string = random_bytes_hex(45);
my $base64_string = random_bytes_b64(45);
my $base64url_string = random_bytes_b64u(45);
my $alphanumeric_string = random_string(30);
my $string = random_string_from('ACGT', 64);
my $floating_point_number_0_to_1 = rand;
my $floating_point_number_0_to_88 = rand(88);
my $unsigned_32bit_int = irand;
### OO interface:
use Crypt::PRNG::RC4;
my $prng = Crypt::PRNG::RC4->new;
my $seeded_prng = Crypt::PRNG::RC4->new("some data used for seeding PRNG");
my $octets = $prng->bytes(45);
my $hex_string = $prng->bytes_hex(45);
my $base64_string = $prng->bytes_b64(45);
my $base64url_string = $prng->bytes_b64u(45);
my $alphanumeric_string = $prng->string(30);
my $string = $prng->string_from('ACGT', 64);
my $floating_point_number_0_to_1 = $prng->double;
my $floating_point_number_0_to_88 = $prng->double(88);
my $unsigned_32bit_int = $prng->int32;
πΈ DESCRIPTION πΈ
This module provides an interface to the RC4-based pseudo-random number generator. It's literally a thin wrapper around Crypt::PRNG with the algorithm fixed to RC4. All functions and methods accept the same arguments and return the same values as the corresponding Crypt::PRNG entries. iconic consistency, zero surprise π
π¨ Warning, bestie: RC4 is provided for compatibility with legacy code only and is not recommended for new designs. It's giving "museum piece," not "new project main character." Don't build your whole new thing on it, okay?
π EXPORT π
Nothing is exported by default. If you want selected functions, do this:
use Crypt::PRNG::RC4 qw(random_bytes random_string);
Or all of them at once:
use Crypt::PRNG::RC4 ':all';
π§ FUNCTIONS π§
All functions below behave exactly like the corresponding Crypt::PRNG functions, but use a hidden Crypt::PRNG::RC4 object internally. Sneaky little helper object, but the behavior is the same.
random_bytes
See random_bytes in Crypt::PRNG for the full tea. Same behavior, same arguments, same return values. π΅
random_bytes_hex
See random_bytes_hex in Crypt::PRNG β same everything, just routed through the hidden RC4 wrapper.
random_bytes_b64
See random_bytes_b64 in Crypt::PRNG β the base64 situation is exactly the same.
random_bytes_b64u
See random_bytes_b64u in Crypt::PRNG β base64url behavior, same as the parent entry.
random_string
See random_string in Crypt::PRNG β same string-making energy.
random_string_from
See random_string_from in Crypt::PRNG β same "pick from this character set" behavior.
rand
See rand in Crypt::PRNG β same floating-point number behavior.
irand
See irand in Crypt::PRNG β same unsigned 32-bit integer behavior.
π METHODS π
Unless noted otherwise, assume $prng is an existing Crypt::PRNG::RC4 object created via new. Got it? Good. π«Ά
new
my $prng = Crypt::PRNG::RC4->new;
my $seeded_prng = Crypt::PRNG::RC4->new($seed);
Creates a PRNG object using the RC4 algorithm. If $seed is omitted, the object is automatically seeded by the underlying Crypt::PRNG logic. If $seed is provided it must be at least 5 bytes long; empty or shorter seeds fail during initialization. So don't try to slide in a tiny seed and expect magic β it will fail during initialization. π
bytes
See bytes in Crypt::PRNG β same byte-generating behavior as the parent entry.
bytes_hex
See bytes_hex in Crypt::PRNG β same hex-string behavior.
bytes_b64
See bytes_b64 in Crypt::PRNG β same base64 behavior.
bytes_b64u
See bytes_b64u in Crypt::PRNG β same base64url behavior.
string
See string in Crypt::PRNG β same alphanumeric string behavior.
string_from
See string_from in Crypt::PRNG β same "string from this set of characters" behavior.
double
See double in Crypt::PRNG β same floating-point number behavior.
int32
See int32 in Crypt::PRNG β same unsigned 32-bit integer behavior.
π SEE ALSO π
Crypt::PRNGβ the parent wrapper situation; go check it out for the full deets.https://en.wikipedia.org/wiki/RC4_cipherβ the Wikipedia page about the RC4 cipher, for your lore deep-dive. π₯
This page came from perl v5.42.0, dated 2026-05-11, and it's Crypt::PRNG::RC4(3) β bye bestie, go make good choices with your PRNGs! πβ¨
π¦ 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