upgrade version

This commit is contained in:
Aitor Ruano 2020-03-23 15:16:43 +01:00
parent 912fef96b1
commit eb05d00080
2 changed files with 7 additions and 9 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "sharks" name = "sharks"
version = "0.3.2" version = "0.3.3"
authors = ["Aitor Ruano <codearm@pm.me>"] authors = ["Aitor Ruano <codearm@pm.me>"]
description = "Fast, small and secure Shamir's Secret Sharing library crate" description = "Fast, small and secure Shamir's Secret Sharing library crate"
homepage = "https://github.com/c0dearm/sharks" homepage = "https://github.com/c0dearm/sharks"

View File

@ -49,15 +49,13 @@ pub fn random_polynomial(s: GF256, k: u8) -> Vec<GF256> {
// Each polynomial corresponds to one byte chunk of the original secret. // Each polynomial corresponds to one byte chunk of the original secret.
// The iterator will start at `x = 1` and end at `x = 255`. // The iterator will start at `x = 1` and end at `x = 255`.
pub fn get_evaluator(polys: Vec<Vec<GF256>>) -> impl Iterator<Item = Share> { pub fn get_evaluator(polys: Vec<Vec<GF256>>) -> impl Iterator<Item = Share> {
(1..=u8::max_value()).map(GF256).map(move |x| { (1..=u8::max_value()).map(GF256).map(move |x| Share {
(Share {
x, x,
y: polys y: polys
.iter() .iter()
.map(|p| p.iter().fold(GF256(0), |acc, c| acc * x + *c)) .map(|p| p.iter().fold(GF256(0), |acc, c| acc * x + *c))
.collect(), .collect(),
}) })
})
} }
#[cfg(test)] #[cfg(test)]