upgrade version
This commit is contained in:
parent
912fef96b1
commit
eb05d00080
|
@ -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"
|
||||||
|
|
14
src/math.rs
14
src/math.rs
|
@ -49,14 +49,12 @@ 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(),
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue