From bf0468e405b0f82f5fe34a8405ba428a68f3b77b Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 16 Aug 2023 16:38:10 -0500 Subject: [PATCH] keyfork-mnemonic-generate: properly slice entropy --- keyfork-mnemonic-generate/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keyfork-mnemonic-generate/src/main.rs b/keyfork-mnemonic-generate/src/main.rs index e10e4ba..ec31d2c 100644 --- a/keyfork-mnemonic-generate/src/main.rs +++ b/keyfork-mnemonic-generate/src/main.rs @@ -172,7 +172,7 @@ fn bitslice_to_usize(bitslice: [bool; 11]) -> usize { index } -fn main() -> Result<(), Box> { +fn main() -> Result<()> { if !env::vars() .any(|(name, _)| name == "SHOOT_SELF_IN_FOOT" || name == "INSECURE_HARDWARE_ALLOWED") { @@ -194,7 +194,7 @@ fn main() -> Result<(), Box> { let entropy = &mut [0u8; 256 / 8]; random_handle.read_exact(&mut entropy[..])?; - let mnemonic = Mnemonic::from_entropy(entropy)?; + let mnemonic = Mnemonic::from_entropy(&entropy[..bit_size / 8])?; println!("{mnemonic}"); @@ -216,7 +216,7 @@ mod tests { } #[test] - fn loads_mnemonics() -> Result<(), Box> { + fn loads_mnemonics() -> Result<()> { let content = include_str!("test/vectors.json"); let jsonobj: serde_json::Value = serde_json::from_str(content)?;