---
name: "Crypt::PRNG::Sober128"
section: "3pm"
platform: "linux"
package: "perl-cryptx"
version: "0.091-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Crypt::PRNG::Sober128"
---

# Crypt::PRNG::Sober128(3pm)

Cryptographically secure PRNG based on Sober128 (stream cipher) algorithm

## NAME

Crypt::PRNG::Sober128 - Cryptographically secure PRNG based on Sober128 (stream cipher) algorithm

## SYNOPSIS

```
   ### 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;
   ### 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

Provides an interface to the Sober128-based pseudo-random number generator.

This is a thin wrapper around Crypt::PRNG with the algorithm fixed to Sober128. All functions and methods accept the same arguments and return the same values as the corresponding Crypt::PRNG entries.

## EXPORT

Nothing is exported by default.

You can export selected functions:

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

Or all of them at once:

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

## FUNCTIONS

All functions below behave exactly like the corresponding Crypt::PRNG functions, but use a hidden `"Crypt::PRNG::Sober128"` object internally.

### 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"`.

### 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.

### 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

- •

  Crypt::PRNG

- •

  \<https://en.wikipedia.org/wiki/SOBER-128\>
