Shared secret
This module provides utilities to dissociate and recombine Shamir "shared secrets", for which some parts (shards) can be lost without preventing the reconstruction of the whole secret.
- wacryptolib.shared_secret.split_secret_into_shards(secret, *, shard_count, threshold_count)
Generate a Shamir shared secret of shard_count subkeys, with threshold_count of them required to recompute the initial bytestring.
- Parameters:
secret (
bytes
) -- bytestring to separate as shards, whatever its lengthshard_count (
int
) -- the number of shards to be created for the secretthreshold_count (
int
) -- the minimal number of shards needed to recombine the key
- Return type:
list
- Returns:
list of full bytestring shards
- wacryptolib.shared_secret.recombine_secret_from_shards(shards)
Reconstruct a secret from list of Shamir shards
- Parameters:
shards (
Sequence
) -- list of k full-length shards (k being exactly the threshold of this shared secret)- Return type:
bytes
- Returns:
the key reconstructed as bytes