.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Crypt::PRNG::RC4 3" .TH Crypt::PRNG::RC4 3 2026-08-10 "perl v5.42.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Crypt::PRNG::RC4 \- Legacy RC4\-based PRNG wrapper .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& ### 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(\*(AqACGT\*(Aq, 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(\*(AqACGT\*(Aq, 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; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Provides an interface to the RC4\-based pseudo\-random number generator. .PP This is 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. .PP RC4 is provided for compatibility with legacy code only and is not recommended for new designs. .SH EXPORT .IX Header "EXPORT" Nothing is exported by default. .PP You can export selected functions: .PP .Vb 1 \& use Crypt::PRNG::RC4 qw(random_bytes random_string); .Ve .PP Or all of them at once: .PP .Vb 1 \& use Crypt::PRNG::RC4 \*(Aq:all\*(Aq; .Ve .SH FUNCTIONS .IX Header "FUNCTIONS" All functions below behave exactly like the corresponding Crypt::PRNG functions, but use a hidden \f(CW\*(C`Crypt::PRNG::RC4\*(C'\fR object internally. .SS random_bytes .IX Subsection "random_bytes" See "random_bytes" in Crypt::PRNG. .SS random_bytes_hex .IX Subsection "random_bytes_hex" See "random_bytes_hex" in Crypt::PRNG. .SS random_bytes_b64 .IX Subsection "random_bytes_b64" See "random_bytes_b64" in Crypt::PRNG. .SS random_bytes_b64u .IX Subsection "random_bytes_b64u" See "random_bytes_b64u" in Crypt::PRNG. .SS random_string .IX Subsection "random_string" See "random_string" in Crypt::PRNG. .SS random_string_from .IX Subsection "random_string_from" See "random_string_from" in Crypt::PRNG. .SS rand .IX Subsection "rand" See "rand" in Crypt::PRNG. .SS irand .IX Subsection "irand" See "irand" in Crypt::PRNG. .SH METHODS .IX Header "METHODS" Unless noted otherwise, assume \f(CW$prng\fR is an existing \f(CW\*(C`Crypt::PRNG::RC4\*(C'\fR object created via \f(CW\*(C`new\*(C'\fR. .SS new .IX Subsection "new" .Vb 2 \& my $prng = Crypt::PRNG::RC4\->new; \& my $seeded_prng = Crypt::PRNG::RC4\->new($seed); .Ve .PP Creates a PRNG object using the RC4 algorithm. If \f(CW$seed\fR is omitted, the object is automatically seeded by the underlying Crypt::PRNG logic. If \&\f(CW$seed\fR is provided it must be at least 5 bytes long; empty or shorter seeds fail during initialization. .SS bytes .IX Subsection "bytes" See "bytes" in Crypt::PRNG. .SS bytes_hex .IX Subsection "bytes_hex" See "bytes_hex" in Crypt::PRNG. .SS bytes_b64 .IX Subsection "bytes_b64" See "bytes_b64" in Crypt::PRNG. .SS bytes_b64u .IX Subsection "bytes_b64u" See "bytes_b64u" in Crypt::PRNG. .SS string .IX Subsection "string" See "string" in Crypt::PRNG. .SS string_from .IX Subsection "string_from" See "string_from" in Crypt::PRNG. .SS double .IX Subsection "double" See "double" in Crypt::PRNG. .SS int32 .IX Subsection "int32" See "int32" in Crypt::PRNG. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP \(bu 4 Crypt::PRNG .IP \(bu 4