Switch to setuptools, fixing build
Add missing imports
Correct executable bits
An implementation of Shamir's secret sharing for use as a Python library or from a terminal.
CAUTION: The cryptography in this implementation has not been reviewed or audited in any way. Use it at your own risk.
$ pip3 install git+https://git.sr.ht/~fluix/sss
$ sss
sss: Shamir's secret sharing implementation
usage: sss gen [-h] [-n SHARES] [-k THRESHOLD] [--validate] secret
positional arguments:
secret Secret to split into shares
optional arguments:
-h, --help show this help message and exit
-n SHARES, --shares SHARES
Shares to be created (default: 5)
-k THRESHOLD, --threshold THRESHOLD
Shares required to recover secret (default: 3)
--validate Verify that any combination of threshold shares recovers secret. (default: False)
A sample run with the secret testing123
looks as such:
$ python3 -m sss gen testing123
Generating shares... Done!
sss-v0-SHARE-n1-e89-IorIxat1qcINz6M=
sss-v0-SHARE-n2-e89-CPaLM2DZ5k8aWSs=
sss-v0-SHARE-n3-e89-AbO3rLyUliQOVs7K
sss-v0-SHARE-n4-e89-ASLOLWFGqmL_wzCC
sss-v0-SHARE-n5-e89-VjoNIXcWoyNfflI=
Any 3 of these 5 can be used to recover the secret.
usage: sss rec [-h] shares [shares ...]
positional arguments:
shares Shares to recover secret from
optional arguments:
-h, --help show this help message and exit
Using any three of the shares (in this case numbers 1, 3, and 5) from the previous sample returns the secret:
$ python3 -m sss rec sss-v0-SHARE-n1-e89-IorIxat1qcINz6M= sss-v0-SHARE-n3-e89-AbO3rLyUliQOVs7K sss-v0-SHARE-n5-e89-VjoNIXcWoyNfflI=
testing123
TODO; for now, see class and method docstrings.
sss is licensed under the MIT license, see LICENSE.
Copyright (c) 2021 Steven Guikal