Skip to content

Commit

Permalink
Use Bitcoin::Util::randInt instead of rand to generate keys (grondilu#6)
Browse files Browse the repository at this point in the history
Perl's built-in rand is not cryptographically-secure. In particular,
it is only seeded with 4 bytes of entropy.

Bitcoin::Util::randInt appears to be an improvement but also hasn't
been properly analysed.
  • Loading branch information
jes committed Aug 28, 2016
1 parent 0b340f2 commit 1ba8294
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion EC/DSA.pm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ sub public_key {
sub random {
my $this = shift;
my $i = 0;
$i = 256*$i + int rand 256 for 1..32;
$i = 256*$i + int Bitcoin::Util::randInt(256) for 1..32;
$this->new($i);
}

Expand Down

0 comments on commit 1ba8294

Please sign in to comment.