Package: shamir-mnemonic
python-shamir-mnemonicReference implementation of SLIP-0039: Shamir’s Secret-Sharing for Mnemonic
CodesAbstractThis SLIP describes a standard and interoperable implementation of Shamir’s
secret sharing (SSS). SSS splits a secret into unique parts which can be
distributed among participants, and requires a specified minimum number of
parts to be supplied in order to reconstruct the original secret. Knowledge of
fewer than the required number of parts does not leak information about the
secret.SpecificationSeehttps://github.com/satoshilabs/slips/blob/master/slip-0039.mdfor full
specification.SecurityThis implementation is not using any hardening techniques. Secrets are passed in the
open, and calculations are most likely trivially vulnerable to side-channel attacks.The purpose of this code is to verify correctness of other implementations.It should
not be used for handling sensitive secrets.InstallationWith pip from GitHub:$pip3installshamir-mnemonicFrom local checkout for development:$python3setup.pydevelopCLI usageCLI tool is included as a reference and UX testbed.Warning:this tool makes no attempt to protect sensitive data! Use at your own risk.
If you need this to recover your wallet seeds, make sure to do it on an air-gapped
computer, preferably running a live system such as Tails.When theshamir_mnemonicpackage is installed, you can use theshamircommand:$shamircreate3of5# create a 3-of-5 set of shares$shamirrecover# interactively recombine shares to get the master secretYou can supply your own master secret as a hexadecimal string:$shamircreate3of5--master-secret=cb21904441dfd01a392701ecdc25d61cYou can specify a custom scheme. For example, to create three groups, with 2-of-3,
2-of-5, and 4-of-5, and require completion of all three groups, use:$shamircreatecustom--group-threshold3--group23--group25--group45Useshamir --helporshamir create --helpto see all available options.If you want to run the CLI from a local checkout without installing, use the following
command:$python3-mshamir_mnemonic.cliTest vectorsThe test vectors in vectors.json are given as a list of triples. The first member of the
triple is a description of the test vector, the second member is a list of mnemonics and
the third member is the master secret which results from combining the mnemonics. The
master secret is encoded as a string containing two hexadecimal digits for each byte. If
the string is empty, then attempting to combine the given set of mnemonics should result
in error. The passphrase “TREZOR” is used for all valid sets of mnemonics.ChangelogAll notable changes to this project will be documented in this file.The format is based onKeep a Changelog, and this project adheres toSemantic Versioning.UnreleasedNo changes yet0.2.2- 2021-12-07ChangedRelaxed Click constraint so that Click 8.x is allowedAppliedblackandflake8code style0.2.1- 2021-02-03FixedRe-released on the correct commit0.2.0- 2021-02-03AddedIntroduceslip_emsandrecover_emsto separate password-based encryption from the Shamir Secret recoveryIntroduce classes representing a share and group-common parametersIntroduceRecoveryStateclass that allows reusing the logic of theshamir recovercommandChangedUsesecretsmodule instead ofos.urandomRefactor and restructure code into separate modules0.1.0 - 2019-07-19AddedInitial implementation