Bytes::Random::Secure is a Perl module that provides three functions that can be used anytime you need a string (or MIME Base64 representation, or hex-digits representation) of a specific number of random bytes.
This module can be a drop-in replacement for Bytes::Random, with the primary enhancement of using a much higher quality random number generator to create the random data. The random number generator comes from Math::Random::Secure, and is suitable for cryptographic purposes, including the generation of random salt or random secrets.
In addition to providing random_bytes(), this module also provides two functions not found in Bytes::Random: random_bytes_base64(), and random_bytes_hex.
SYNOPSIS
use Bytes::Random::Secure qw(
random_bytes random_bytes_base64 random_bytes_hex
);
my $bytes = random_bytes(32); # A string of 32 random bytes.
my $bytes_as_base64 = random_bytes_base64(57);
my $bytes_as_hex = random_bytes_hex(8);
Product's homepage
Requirements:
· Perl