pub struct Polynomial {
pub points: Vec<PointInFiniteField>,
pub threshold: usize,
}Expand description
Polynomial over GF(p) represented by its evaluation points.
Used for Lagrange interpolation in Shamir’s Secret Sharing. The polynomial passes through the stored points and can be evaluated at any x value using Lagrange interpolation.
Fields§
§points: Vec<PointInFiniteField>§threshold: usizeImplementations§
Source§impl Polynomial
impl Polynomial
Sourcepub fn new(points: Vec<PointInFiniteField>, threshold: Option<usize>) -> Self
pub fn new(points: Vec<PointInFiniteField>, threshold: Option<usize>) -> Self
Create a new polynomial from points with optional threshold.
If threshold is not specified, it defaults to the number of points.
Sourcepub fn from_private_key(key_bytes: &[u8], threshold: usize) -> Self
pub fn from_private_key(key_bytes: &[u8], threshold: usize) -> Self
Create a polynomial from a private key for Shamir’s Secret Sharing.
The private key value is the y-intercept (x=0, y=key). Additional (threshold - 1) random points are generated.
Auto Trait Implementations§
impl Freeze for Polynomial
impl !RefUnwindSafe for Polynomial
impl Send for Polynomial
impl Sync for Polynomial
impl Unpin for Polynomial
impl UnsafeUnpin for Polynomial
impl !UnwindSafe for Polynomial
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more