Skip to main content

Python port of Shamir key Split and Combine methods from Hashicorp Vault.

Project description

pyshamir banner

Quality Gate Status Lines of Code Reliability Rating Vulnerabilities Security Rating Coverage OpenSSF Scorecard

Description

Python port of Shamir key Split and Combine methods from Hashicorp Vault.

Installation

pip install pyshamir 

Usage

Split & Combine

from pyshamir import split, combine
import secrets

# generate a random secret, here secret is a 32 bytes
secret = secrets.token_bytes(32)

# set the number of shares; i.e. the number of parts to split the secret into
num_of_shares = 5

# threshold is minimum number of keys required to get back the secret
threshold = 3

# split to get a list of bytearrays which can be combined later to get back the secret
parts = split(secret, num_of_shares, threshold)

# Now, the parts be combined to get back the secret
recomb_secret = combine(parts)

References

  1. Shamir Secret Sharing | Wikipedia
  2. Go Implementation | HashiCorp Vault

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

pyshamir-1.0.4.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

pyshamir-1.0.4-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

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