Function rusty_secrets::wrapped_secrets::split_secret [−][src]
pub fn split_secret(
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.
Uses an OsRng
as a source of entropy.
Examples
use rusty_secrets::wrapped_secrets::split_secret; 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( 7, 10, &secret.as_bytes(), Some("text/html".to_string()), true, ); match result { Ok(shares) => { // Do something with the shares }, Err(_) => { // Deal with error } }