Dne Út 09.čec.2019 04:46:06, ppisar napsal(a):
Show quoted text> Dne Út 09.čec.2019 04:28:10, ppisar napsal(a):
> > For some reason $self->{_RNG}->random_numbers($_CLASS-
> > > config_random_numbers_required($self->{_CONFIG})) returns a number
> > that does not match m/^1|(0([.]\d+)?)$/sx is thus is rejected as an
> > invalid random value.
>
> The out-of-range number comes from Math::Random::Secure::rand() called
> at Crypt::HSXKPasswd::RNG::Math_Random_Secure::random_numbers().
A minimal reproducer is:
use Test::More tests => 1;
use Crypt::HSXKPasswd;
ok(eval{hsxkpasswd()}, 'password generation with defaults');
diag($@) if $@;
$ while (perl -Ilib t/test.t); do :; done
1..1
ok 1 - password generation with defaults
1..1
[...]
not ok 1 - password generation with defaults
# Failed test 'password generation with defaults'
# at t/test.t line 3.
# ERROR - Crypt::HSXKPasswd::password(): Failed to generate password with the following error: ERROR - Crypt::HSXKPasswd::_increment_random_cache(): random function returned and invalid value (7.04464036971331e-05) at t/test.t line 3.
# at t/test.t line 3.
# Looks like you failed 1 test of 1.
I'm unable to reproduce it with:
use Test::More tests => 1;
require Math::Random::Secure;
my $n = Math::Random::Secure::rand();
like($n, qr/^1|(0([.]\d+)?)$/sx, 'In range');