Function rusty_secrets::wrapped_secrets::split_secret_rng [−][src]
pub fn split_secret_rng<R: Rng>(
rng: &mut R,
k: u8,
n: u8,
secret: &[u8],
mime_type: Option<String>,
sign_shares: bool
) -> Result<Vec<String>>
Performs threshold k-out-of-n Shamir's secret sharing with a custom RNG.
Examples
use rusty_secrets::wrapped_secrets::split_secret_rng; use rand::ChaChaRng; let secret = "These programs were never about terrorism: they’re about economic spying, \ social control, and diplomatic manipulation. They’re about power."; let result = split_secret_rng( &mut ChaChaRng::new_unseeded(), 7, 10, &secret.as_bytes(), Some("text/html".to_string()), true, ); match result { Ok(shares) => { // Do something with the shares }, Err(_) => { // Deal with error } }