Package: pygfssss
Overviewpygfssssis a Python 3 implementation ofShamir's Secret Sharing Scheme,
using polynomials over GF(256).Shamir's Secret Sharing can be used to split a secret into multiple shares. A specified threshold amount of
shares can be used to reconstruct the original secret.Having less than the threshold amount of shares doesn't provide any information on the secret (aside of
its size).Originspygfssssis heavily based on Mathias Herberts' PySSSS (https://github.com/hbs/PySSSS), extended with
the following features -Python 3 (only) support.Single X value used per share - for all bytes (instead of a different X value for every byte).Code simplified and clarified somewhat.Command line tool (pygfssss) provided.Compatibility withgfshare-
using 0x11d prime polynomial,pygfsplit/pygfcombinecommand line tools provided.Unit tests coverage.Installationpygfssssis provided as a standard Python package. It can be installed with standard Python tools.For example, Linux installation in a virtualenv from PyPI -python -m virtualenv venv
venv/bin/python -m pip install --upgrade pygfssssOr, directly from GitHub -python -m virtualenv venv
venv/bin/python -m pip install --upgrade git+https://github.com/trianglee/pygfsssspygfssssruns on Linux and Windows.pygfssssCommand Line Toolpygfsssscan be used to split and combine.To split secret.txt into 5 shares, where any 3 are needed to reconstruct -cat secret.txt | venv/bin/pygfssss split 3 5(each output line is a different share).To combine some of these shares back into the secret -cat share1.txt share3.txt share5.txt | venv/bin/pygfssss combine(if an insufficient number of shares is provided, the output would be random).gfshareCompatibilitygfshareis a de-facto standard of
Shamir's Secret Sharing Scheme for Linux.pygfsplitandpygfcombineofpygfssssare compatible withgfsplitandgfcombineofgfshare. Shares generated bygfsplitcan be combined usingpygfcombineand shares generated bypygfsplitcan be combined usinggfcombine.This cross-compatibility allows users of both packages to know they have a reliable alternative
implementation from a different source.pygfsssscommand line tool generated shares arenotdirectly compatible withgfshare,
but it is trivial to convert them to begfshareshares manually if needed -The first byte (two digits) of each share is the file extension (in decimal format).The rest of the bytes are the contents (in binary representation).The followingbashscript can convert a set ofpygfssssshares to a set ofgfshareshares -cat shares.txt |                                                             
while read in; do                                                            
  # Get share number from first two digits.                                  
  SHARE_NUM_HEX=$(echo "$in" | cut -c1-2)                                    
  # Convert it to decimal.                                                   
  SHARE_NUM_DEC=$((16#$SHARE_NUM_HEX))                                       
  # Pad with leading zeros.                                                  
  SHARE_NUM=$(printf "%03d" $SHARE_NUM_DEC)                                  
  # Convert the rest of the share bytes to binary and write to share file.   
  echo "$in" | cut -c3- | xxd -r -p > share.$SHARE_NUM                       
doneLicensepygfssssis released under the Apache License, Version 2.