|Last Updated||Ratings||Unique User Downloads||Download Rankings|
|2018-12-18 (11 months ago)||Not enough user ratings||Total: 168||All time: 8,569 This week: 350|
|random-bytes 0.12||GNU General Publi...||5.4||PHP 5, Cryptography, Security|
This class can generate cryptographically strong random bytes.
Create random bytes – as cryptographically-strong as possible – from available sources of entropy, and display in different output formats.
random_bytes(), MCrypt, /dev/urandom
Random Bytes Definitions:
array RandomBytes::generate(int $length, string $source);
require('randombytes.class.php'); use CopySense\RandomBytes\RandomBytes; $aData = RandomBytes::generate(32, 'openssl'); var_dump($aData);
The random bytes generated are only as good as the underlying entropy generator of the OS.
Linux's /dev/urandom entropy source is a non-blocking generator 'suitable for most cryptographic purposes'. (/dev/random, being blocking, isn't suitable for this script.)
OpenBSD and FreeBSD have non-blocking /dev/random implementations.
random_bytes() function was added to PHP version 7.0
On Windows, the implementation of MCrypt is known to have problems, which can be confirmed by patterning present in images (instead of non-patterned noise) created from MCrypt-generated data.
The libmcrypt library behind MCrypt is unmaintained and contains unfixed bugs. MCrypt is deprecated in PHP 7.1.
Random Bytes is released under the GPL v.3.
|Version Control||Unique User Downloads||Download Rankings|