Function rusty_secrets::sss::split_secret_rng[][src]

pub fn split_secret_rng<R: Rng>(
    rng: &mut R,
    k: u8,
    n: u8,
    secret: &[u8],
    sign_shares: bool
) -> Result<Vec<String>>

Performs threshold k-out-of-n Shamir's secret sharing with a custom RNG.

Examples

use rusty_secrets::sss::split_secret_rng;

let secret = "These programs were never about terrorism: they’re about economic spying, \
              social control, and diplomatic manipulation. They’re about power.";

let mut rng = some_custom_rng();

match split_secret_rng(&mut rng, 7, 10, &secret.as_bytes(), true) {
    Ok(shares) => {
        // Do something with the shares
    },
    Err(_) => {
        // Deal with error
    }
}