[][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 generate
  • threshold - The number of shares needed to recover the key
  • length - The desired length of the key to generate
  • version - Version of the secret sharing scheme to use. Use SecretSharingVersion::Latest if 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();