-
-
15 Nov 2018 18:56:14 UTC
- Distribution: Math-Prime-Util
- Module version: 0.73
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (1)
- Testers (3290 / 78 / 0)
- Kwalitee
Bus factor: 0- 67.76% Coverage
- License: perl_5
- Perl: v5.6.2
- Activity
24 month- Tools
- Download (602.57KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Carp
- Config
- Exporter
- Math::BigFloat
- Math::BigInt
- Math::Prime::Util::GMP
- Tie::Array
- XSLoader
- base
- constant
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Math::Prime::Util::ChaCha - Pure Perl ChaCha20 CSPRNG
VERSION
Version 0.73
SYNOPSIS
DESCRIPTION
A pure Perl implementation of ChaCha20 with a CSPRNG interface.
FUNCTIONS
csrand
Takes a binary string as input and seeds the internal CSPRNG.
srand
A method for sieving the CSPRNG with a small value. This will not be secure but can be useful for simulations and emulating the system
srand
.With no argument, chooses a random number, seeds and returns the number. With a single integer argument, seeds and returns the number.
irand
Returns a random 32-bit integer.
irand64
Returns a random 64-bit integer.
random_bytes
Takes an unsigned number
n
as input and returns that many random bytes as a single binary string.AUTHORS
Dana Jacobsen <dana@acm.org>
ACKNOWLEDGEMENTS
Daniel J. Bernstein wrote the ChaCha family of stream ciphers in 2008 as an update to the popular Salsa20 cipher from 2005.
RFC7539: "ChaCha20 and Poly1305 for IETF Protocols" was used to create both the C and Perl implementations. Test vectors from that document are used here as well.
For final optimizations I got ideas from Christopher Madsen's Crypt::Salsa20 for how to best work around some of Perl's aggressive dynamic typing. Our core is still about 20% slower than Salsa20.
COPYRIGHT
Copyright 2017 by Dana Jacobsen <dana@acm.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Math::Prime::Util, copy and paste the appropriate command in to your terminal.
cpanm Math::Prime::Util
perl -MCPAN -e shell install Math::Prime::Util
For more information on module installation, please visit the detailed CPAN module installation guide.