Skip to main content

GreyTeamToolbox logo
Github Build Status License Created
Release Released Commits since release

Overview

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.

Installation

pip install wolfsoftware.shamir-secret-sharing

Command Line Usage

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)

Creating Shares

shamir-secret-sharing -c "mysupersecretpassword" -s 5 -t 3

Reconstructing the Secret

shamir-secret-sharing -r share-1.txt share-3.txt share-5.txt

Limitations

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.

Splitting Large files

split -b 4096 original_file block_

Reconstructing the File from 4K Blocks

cat block_* > reconstructed_file

Release files for wolfsoftware.shamir-secret-sharing 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wolfsoftware.shamir-secret-sharing 0.1.3
File Size Uploaded
wolfsoftware_shamir_secret_sharing-0.1.3.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wolfsoftware.shamir-secret-sharing 0.1.3
File Interpreter ABI Platform
wolfsoftware.shamir_secret_sharing-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 28.5 kB

Release files / wolfsoftware_shamir_secret_sharing-0.1.3.tar.gz

Download URL wolfsoftware_shamir_secret_sharing-0.1.3.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d6cba19786c49bd979377d13aed725f48d482d720c92e84c8bf0ece1fb350b8f
BLAKE2b-256 checksum
How to use checksums
89a21f4b8666b6096f010361bad04725dfd1d049292bb7910a5abc4ba3d400c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / wolfsoftware.shamir_secret_sharing-0.1.3-py3-none-any.whl

Download URL wolfsoftware.shamir_secret_sharing-0.1.3-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e879ed15bb40b84952d0b7b38cab5350c19282ff49715060c56b83cb9602107
BLAKE2b-256 checksum
How to use checksums
b96ea58d1d46ba8e7ae49f3299dea83dbda58ae7b0ef1c93a452cd3db584ddbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page