Crypt::...Sober128(3)

πŸ’– Crypt::PRNG::Sober128 β€” Sober128 PRNG, bestie edition πŸ’–

okay so this is a User Contributed Perl Documentation page, the manual name is Crypt::...Sober128(3) (yes bestie, with the lil dots, iykyk ✨), and the whole page is about Crypt::PRNG::Sober128. It's giving secure random vibes, and I'm obsessed.

🌸 NAME 🌸

Crypt::PRNG::Sober128 β€” a cryptographically secure PRNG based on the Sober128 (stream cipher) algorithm. periodt. πŸ’…

✨ SYNOPSIS ✨

Functional interface first, because we love a functional bestie:

### Functional interface:
use Crypt::PRNG::Sober128 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;

and now the OO interface, main character energy:

### OO interface:
use Crypt::PRNG::Sober128;

my $prng = Crypt::PRNG::Sober128->new;
my $seeded_prng = Crypt::PRNG::Sober128->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 gives you an interface to the Sober128-based pseudo-random number generator. lowkey it's a thin wrapper around Crypt::PRNG, except the algorithm is fixed to Sober128. no cap.

All functions and methods accept the same arguments and return the same values as the corresponding Crypt::PRNG entries. so if you already know Crypt::PRNG, you're basically home, bestie 🫢

πŸŽ€ EXPORT πŸŽ€

Nothing is exported by default. nothing. zero. zilch. πŸ™ˆ

You can export selected functions:

use Crypt::PRNG::Sober128 qw(random_bytes random_string);

Or all of them at once, because sometimes you just want the whole vibe:

use Crypt::PRNG::Sober128 ':all';

🌈 FUNCTIONS 🌈

All functions below behave exactly like the corresponding Crypt::PRNG functions, but they use a hidden "Crypt::PRNG::Sober128" object internally. sneaky but iconic. πŸ’…

πŸ’– random_bytes πŸ’–

See "random_bytes" in Crypt::PRNG.

πŸ’– random_bytes_hex πŸ’–

See "random_bytes_hex" in Crypt::PRNG.

πŸ’– random_bytes_b64 πŸ’–

See "random_bytes_b64" in Crypt::PRNG.

πŸ’– random_bytes_b64u πŸ’–

See "random_bytes_b64u" in Crypt::PRNG.

πŸ’– random_string πŸ’–

See "random_string" in Crypt::PRNG.

πŸ’– random_string_from πŸ’–

See "random_string_from" in Crypt::PRNG.

πŸ’– rand πŸ’–

See "rand" in Crypt::PRNG.

πŸ’– irand πŸ’–

See "irand" in Crypt::PRNG.

πŸ‘‘ METHODS πŸ‘‘

Unless noted otherwise, assume $prng is an existing "Crypt::PRNG::Sober128" object created via "new". got it? good. 🫢

🧚 new 🧚

my $prng = Crypt::PRNG::Sober128->new;
my $seeded_prng = Crypt::PRNG::Sober128->new($seed);

Creates a PRNG object using the Sober128 algorithm. If $seed is omitted, the object is automatically seeded by the underlying Crypt::PRNG logic. cute and convenient. ✨

🧚 bytes 🧚

See "bytes" in Crypt::PRNG.

🧚 bytes_hex 🧚

See "bytes_hex" in Crypt::PRNG.

🧚 bytes_b64 🧚

See "bytes_b64" in Crypt::PRNG.

🧚 bytes_b64u 🧚

See "bytes_b64u" in Crypt::PRNG.

🧚 string 🧚

See "string" in Crypt::PRNG.

🧚 string_from 🧚

See "string_from" in Crypt::PRNG.

🧚 double 🧚

See "double" in Crypt::PRNG.

🧚 int32 🧚

See "int32" in Crypt::PRNG.

⭐ SEE ALSO ⭐


okay that's the whole page bestie. the footer vibes are: perl v5.42.0, dated 2026-05-11, and the manual name is Crypt::...Sober128(3). mwah πŸ’‹πŸ’…βœ¨

πŸ“¦ where this page comes from