Shamir's secret sharing (SSS) is an efficient secret sharing algorithm for distributing private information (the "secret") among a group. The secret cannot be revealed unless a quorum of the group acts together to pool their knowledge.
To achieve this, the secret is mathematically divided into parts (the "shares") from which the secret can be reassembled only when a sufficient number of shares are combined. SSS has the property of information-theoretic security, meaning that even if an attacker steals some shares, it is impossible for the attacker to reconstruct the secret unless they have stolen the quorum number of shares.
pip install wolfsoftware.shamir-secret-sharing
usage: shamir-secret-sharing [-h] [-V] [-s SHARES] [-t THRESHOLD] [-o] (-c CREATE | -r SHARE [SHARE ...])
Shamir's Secret Sharing CLI
flags:
-h, --help Show this help message and exit
-V, --version Show program's version number and exit.
optional:
-s SHARES, --shares SHARES
Total number of shares to create (default: None)
-t THRESHOLD, --threshold THRESHOLD
Threshold number of shares needed to reconstruct the secret (default: None)
-o, --output Output shares to screen instead of writing to files (default: False)
required:
-c CREATE, --create CREATE
The secret to share or the file containing the secret (default: None)
-r SHARE [SHARE ...], --reconstruct SHARE [SHARE ...]
List of shares in the form "x,y" or file paths ending with .txt (default: None)
shamir-secret-sharing -c "mysupersecretpassword" -s 5 -t 3
shamir-secret-sharing -r share-1.txt share-3.txt share-5.txt
Secrets are limited to a max size of 4096 bytes
. If you have a secret which is larger than that, then we recommend you split it into 4K blocks
and then use this tool per block, and when you reconstruct the file parts then you can simply reconstruct the original file from there.
split -b 4096 original_file block_
cat block_* > reconstructed_file