Crypt-Random-Seed
view release on metacpan or search on metacpan
lib/Crypt/Random/Seed.pm view on Meta::CPAN
C</dev/random> for the UNIX-like strong randomness source,
C</dev/urandom> for the UNIX-like non-blocking randomness source,
C<TESHA2-strong> for the userspace entropy method when considered strong,
C<TESHA2-weak> for the userspace entropy method when considered weak.
Other methods may be supported in the future. User supplied sources may be
named anything other than one of the defined names.
=head2 is_strong
Returns 1 or 0 indicating whether the source is considered a strong source
of randomness. See the L</"STRENGTH"> section for more discussion of what
this means, and the L<source table|/"SOURCE TABLE"> for what we think of each
source.
=head2 is_blocking
Returns 1 or 0 indicating whether the source can block on read. Be aware
that even if a source doesn't block, it may be extremely slow.
=head1 AUTHORS
Dana Jacobsen E<lt>dana@acm.orgE<gt>
=head1 ACKNOWLEDGEMENTS
To the best of my knowledge, Max Kanat-Alexander was the original author of
the Perl code that uses the Win32 API. I used his code as a reference.
David Oswald gave me a lot of help with API discussions and code reviews.
=head1 SEE ALSO
The first question one may ask is "Why yet another module of this type?"
None of the modules on CPAN quite fit my needs, hence this. Some alternatives:
=head2 L<Crypt::Random::Source>
A comprehensive system using multiple plugins. It has a nice API, but
uses L<Any::Moose> which means you're loading up Moose or Mouse just to
read a few bytes from /dev/random. It also has a very long dependency chain,
with on the order of 40 modules being installed as prerequisites (depending
of course on whether you use any of them on other projects). Lastly, it
requires at least Perl 5.8, which may or may not matter to you. But it
matters to some other module builders who end up with the restriction in
their modules.
=head2 L<Crypt::URandom>
A great little module that is almost what I was looking for.
L<Crypt::Random::Seed> will act the same if given the constructor:
my $source = Crypt::Random::Seed->new(
NonBlocking => 1,
Only => [qw(/dev/random /dev/urandom Win32)]
);
croak "No randomness source available" unless defined $source;
Or you can leave out the C<Only> and have TESHA2 as a backup.
=head2 L<Crypt::Random>
Requires L<Math::Pari> which makes it unacceptable in some environments.
Has more features (numbers in arbitrary bigint intervals or bit sizes).
L<Crypt::Random::Seed> is taking a simpler approach, just handling returning
octets and letting upstream modules handle the rest.
=head2 L<Data::Entropy>
An interesting module that contains a source encapsulation (defaults to system
rand, but has many plugins), a good CSPRNG (AES in counter mode), and the
L<Data::Entropy::Algorithms> module with many ways to get bits, ints, bigints,
floats, bigfloats, shuffles, and so forth. From my perspective, the
algorithms module is the highlight, with a lot of interesting code.
=head2 Upstream modules
Some modules that could use this module to help them:
L<Bytes::Random::Secure>,
L<Math::Random::ISAAC>,
L<Math::Random::Secure>,
and L<Math::Random::MT>
to name a few.
=head1 COPYRIGHT
Copyright 2013 by Dana Jacobsen E<lt>dana@acm.orgE<gt>
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
The software is provided "AS IS", without warranty of any kind, express or
implied, including but not limited to the warranties of merchantability,
fitness for a particular purpose and noninfringement. In no event shall the
authors or copyright holders be liable for any claim, damages or other
liability, whether in an action of contract, tort or otherwise, arising from,
out of or in connection with the software or the use or other dealings in
the software.
=cut
( run in 2.587 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )