NAME

Crypt::Bear::PRNG - A baseclass for PRNGs in BearSSL

VERSION

version 0.002

SYNOPSIS

$prng->system_seed;
say unpack 'H*', $prng->generate(16);

DESCRIPTION

This is a base class for cryptographically secure pseudo random number generators. At the moment there are two of such implemented in this distribution: Crypt::Bear::HMAC_DRBG and Crypt::Bear::AES_DRBG.

METHODS

generate($length)

This method produces $length pseudorandom bytes and returns them. The context is updated accordingly.

system_seed()

This feeds entropy from the system, returning true on success. In almost any cryptographic use either calling this or seeding it with an appropriate amount of entropy is essential for safe operation of the PRNG.

This is known to be supported on Linux, BSD, Mac, Windows, AIX and Solaris, as well as any x86 platform when compiling with gcc/clang.

system_seeder_name()

The name of the system seeder, or 'none' if none is available.

update($data)

Inject additional seed bytes. The provided seed bytes are added into the PRNG internal entropy pool.

AUTHOR

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.