From c5d33bc5da97d5b67538dd8acd3ab62fcfbe40bd Mon Sep 17 00:00:00 2001 From: TQ Hirsch Date: Sun, 14 Jan 2024 04:05:45 +0100 Subject: [PATCH] Off-by-one error in polynomial degree calculation fixed --- src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4047c85..7bcbc44 100644 --- a/src/main.rs +++ b/src/main.rs @@ -145,7 +145,10 @@ impl Command for GenPoly { let mut polys = Vec::with_capacity(payload.len()); for i in 0..payload.len() { - polys.push(rng.sample(UniformPoly{ intercept: GF256::from(payload[i]), degree: self.min_shares as usize})); + if i % 1000 == 0 { + eprint!("\rGenerated {i}/{}", payload.len()); + } + polys.push(rng.sample(UniformPoly{ intercept: GF256::from(payload[i]), degree: self.min_shares as usize - 1})); } // export the poly @@ -159,7 +162,7 @@ impl Command for GenShare { eprintln!("Reading poly"); let mut poly: Vec> = serde_cbor::from_reader(io::stdin())?; eprintln!("Read poly"); - let mut rng = rand::rngs::JitterRng::new()?; + let mut rng = rand::rngs::OsRng::new()?; let share = rssss::s4::Share::new((self.share_no as u8).into(), poly.as_slice()); eprintln!("{share:?}");