Skip to content

Instantly share code, notes, and snippets.

@kayabaNerve
Last active January 20, 2023 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kayabaNerve/3ff25aa5815c3d715654e1486e8a85ae to your computer and use it in GitHub Desktop.
Save kayabaNerve/3ff25aa5815c3d715654e1486e8a85ae to your computer and use it in GitHub Desktop.
fn polynomial<F: PrimeField + Zeroize>(coefficients: &[Zeroizing<F>], l: u16) -> Zeroizing<F> {
let l = F::from(u64::from(l));
let mut share = Zeroizing::new(F::zero());
for (idx, coefficient) in coefficients.iter().rev().enumerate() {
*share += coefficient.deref();
if idx != (coefficients.len() - 1) {
*share *= l;
}
}
share
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment