address issue#10: in Crypt::Random mode, use integer output directly, use correct size

This commit is contained in:
Thomas von Dein
2017-10-04 11:44:03 +02:00
parent 32e12aa64c
commit b51bb9f89e

View File

@@ -58,9 +58,8 @@ BEGIN {
}
else {
*Crypt::PWSafe3::random = sub {
my($this, $len) = @_;
my $bits = makerandom(Size => 256, Strength => 1);
return substr($bits, 0, $len);
my($this, $len) = @_;
return makerandom(Size => $len * 8, Strength => 1, Uniform => 1);
};
}
}