Skip to main content

A CLI implementation of Shamir's secret sharing.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wolfsoftware_shamir_secret_sharing-0.1.2.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file wolfsoftware_shamir_secret_sharing-0.1.2.tar.gz.

File metadata

File hashes

Hashes for wolfsoftware_shamir_secret_sharing-0.1.2.tar.gz
Algorithm Hash digest
SHA256 027dd60faf8874b29636a96c068a9397dc0e9b4a3613327dc8613594e6e989dc
MD5 b59cf1471723dc23f0c39bc98be3b547
BLAKE2b-256 17fb13deb59bd27dd60758fdf0b14e2657c6c2d55a8df2d2dbf88208c343effb

See more details on using hashes here.

File details

Details for the file wolfsoftware.shamir_secret_sharing-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for wolfsoftware.shamir_secret_sharing-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 db098c754972681e9c83678923a091f5ab4fca606524779150b5d74cb79e27c8
MD5 9fd3ae1a76db4cc7e1c492979bf39f1d
BLAKE2b-256 7f5bf27b4b1ff5196db917eb1c9d01fd20f0ce8cb4b963050c593d74e57546cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page