Bytes-Random-Secure

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  - POD and tests for irand().
  - Test::Warn is now an optional dependency.  By ensuring that Test::Warn is
    installed, the module has 100% test coverage (per Devel::Cover).

0.22 2013-01-29
  - Implement suggestions from Dana Jacobsen (Unicode tests, specify minimum 
    versions for dependencies, document installation on older Perls).
  - POD correction -- Removed reference to config_seed.
  - POD: Added INSTALLATION section to address issues with older Perls.
  - POD: Clarified "CAVEATS" with discussion of Unicode support in pre-5.8.9.
  - Added t/23-string_from_unicode.t to test Unicode on Perl 5.8.9+.
  - Added a Unicode example to examples/random_from.pl.
  - Set a CONFIGURE_REQUIRES to pull in a recent ExtUtils::MakeMaker.
  - Set minimum versions on some Core modules from which we're using newer
    features, or which behaved badly in old 5.6.x-contemporary versions.
    
0.21 2013-01-24
  - All functions and methods will now throw an exception if the byte-count
    parameter is passed something that doesn't look like an integer >= 0.
  - examples/*.pl updated to demonstrate new features.
  - Remove silly check for "bag" strings longer than 2**32.

Changes  view on Meta::CPAN

  - Added a few entries in MANIFEST.SKIP.
  
0.10 2012-12-04
  - Better handling of random_bytes() (no parameter passed): Now defaults to
    zero bytes explicitly, so we don't get "uninitialized values" warnings.
  - Added random_string_from($bag,$length) function.
  - Added tests for no param list, as well as for new random_string_from()
    function and its support functions.
  - POD enhancements.
  - Removed bytes pragma; it wasn't necessary, and prevented support for
    unicode code points in random_string_from()'s bag.

0.09 2012-11-02
  - "Changes" is now CPAN::Changes::Spec compliant.
  - Added t/09-changes.t to verify spec compliance.

0.08 2012-10-28
  - Added an example in the ./examples/ directory.
  - Added a minimum Perl version to the distribution metadata.

0.07 2012-09-23

MANIFEST  view on Meta::CPAN

t/04-perlcritic.t
t/05-kwalitee.t
t/06-meta-yaml.t
t/07-meta-json.t
t/09-changes.t
t/10-prereqs.t
t/11-load.t
t/20-functions.t
t/21-bytes_random_tests.t
t/22-random_string_from.t
t/23-string_from_unicode.t
t/24-oo_construct.t
t/26-oo_public.t
t/27-fips140-1.t
t/36-shuffle.t
examples/random-sha512.pl
examples/random-sha512-oo.pl
examples/random-from.pl

t/23-string_from_unicode.t  view on Meta::CPAN


binmode STDOUT, ':encoding(UTF-8)';

my $num_octets = 80;

my $random = Bytes::Random::Secure->new( NonBlocking => 1, Bits => 64 );

my $string = $random->string_from( 'Ѧѧ', $num_octets );

is( length $string, $num_octets,
    'string_from(unicode): Returned proper length string.' );

like( $string, qr/^[Ѧѧ]+$/,
      'string_from(unicode): String contained only Ѧѧ characters.' );


# There's only an 8.27e-23% chance of NOT having both Ѧ and ѧ in the output.
# It would be incredibly poor luck for these tests to fail randomly.
# So we'll take failure to mean there's a bug.

like( $string, qr/Ѧ/,
      'string_from(unicode): Ѧ found in output.' );

like( $string, qr/ѧ/,
      'string_from(unicode): ѧ found in output.' );


done_testing();



( run in 0.587 second using v1.01-cache-2.11-cpan-88abd93f124 )