[−][src]Function devolutions_crypto::secret_sharing::generate_shared_key
pub fn generate_shared_key(
n_shares: u8,
threshold: u8,
length: usize,
version: SecretSharingVersion
) -> Result<Vec<Share>, Error>
Generate a key and split it in n_shares. You will need threshold shares to recover the key.
Arguments
n_shares- Number of shares to generatethreshold- The number of shares needed to recover the keylength- The desired length of the key to generateversion- Version of the secret sharing scheme to use. UseSecretSharingVersion::Latestif you're not dealing with shared data.
Returns
Returns an array of Share.
Example
use devolutions_crypto::secret_sharing::{ generate_shared_key, SecretSharingVersion }; let shares = generate_shared_key(5, 3, 32, SecretSharingVersion::Latest).unwrap();