Skip to main content

split

Function split 

Source
pub fn split<R: RandomSource + ?Sized>(
    secret: &[u8],
    threshold: u8,
    share_count: u8,
    rng: &mut R,
    out: &mut [u8],
) -> Result<()>
Expand description

Split secret into share_count shares, any threshold of which recover it.

out is share_count * secret.len() bytes: share i, whose index is i + 1, is out[i * secret.len()..(i + 1) * secret.len()]. rng supplies threshold - 1 fresh coefficients for every byte of the secret.

Requires 2 <= threshold <= share_count (a threshold of one would make every share the secret) and a non-empty secret. If rng fails, out is wiped and the error returned.