[keys] Fix entropy generation

This commit is contained in:
Alekos Filini
2020-09-24 15:59:46 +02:00
parent b294b11c54
commit 82251a8de4
2 changed files with 16 additions and 1 deletions

View File

@@ -389,7 +389,11 @@ pub trait GeneratableKey<Ctx: ScriptContext>: Sized {
use rand::{thread_rng, Rng};
let mut entropy = Vec::<u8>::with_capacity(Self::ENTROPY_LENGTH);
thread_rng().fill(&mut entropy[..]);
for _ in 0..Self::ENTROPY_LENGTH {
entropy.push(0x00);
}
thread_rng().fill(&mut entropy[..Self::ENTROPY_LENGTH]);
Self::generate_with_entropy(options, &entropy)
}