Function rusty_secrets::sss::split_secret[][src]

pub fn split_secret(
    k: u8,
    n: u8,
    secret: &[u8],
    sign_shares: bool
) -> Result<Vec<String>>

Performs threshold k-out-of-n Shamir's secret sharing.

Uses a rand::OsRng as a source of entropy.

Examples

use rusty_secrets::sss::split_secret;

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

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