pub struct ShamirSecretShare {
pub p: u64,
pub k: usize,
pub n: usize,
}Expand description
Shamir’s Secret Sharing over a finite field Z_p.
Splits a secret s into n shares such that any k shares can reconstruct s via Lagrange interpolation, but any k-1 shares reveal nothing about s.
§WARNING
Educational implementation. The polynomial coefficients are NOT generated with cryptographically secure randomness. Do NOT use for real secrets.
Fields§
§p: u64Prime modulus p (field F_p)
k: usizeThreshold k: minimum shares needed for reconstruction
n: usizeTotal shares n
Implementations§
Split a secret s into n shares using a deterministic polynomial
with coefficients derived from seed (for reproducibility in tests).
Returns a vector of (x, y) pairs where x = 1..=n and y = f(x).
§WARNING
The seed-based coefficient generation is NOT secure. Real Shamir’s scheme requires cryptographically random coefficients.
Auto Trait Implementations§
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