Metadata-Version: 2.4
Name: pyshamir
Version: 1.1.0
Summary: Python port of Shamir key Split and Combine methods from Hashicorp Vault.
Author-email: Srigovind Nayak <sgovind.dev@outlook.com>
Maintainer-email: Srigovind Nayak <sgovind.dev@outlook.com>
License-Expression: MPL-2.0
Project-URL: Homepage, https://github.com/konidev20/pyshamir
Project-URL: Documentation, https://github.com/konidev20/pyshamir
Project-URL: Source Code, https://github.com/konidev20/pyshamir
Project-URL: Issue Tracker, https://github.com/konidev20/pyshamir/issues
Keywords: shamir,pyshamir
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: tests
Requires-Dist: pytest; extra == "tests"
Requires-Dist: pytest-cov; extra == "tests"
Requires-Dist: hypothesis; extra == "tests"
Dynamic: license-file

![pyshamir banner](https://user-images.githubusercontent.com/5201843/232241639-22034903-87c2-4bf0-9b36-2ae9a8481b71.png)

## Description

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

## Requirements

- Python 3.9 or higher

## Installation

```sh
pip install pyshamir 
```

## Usage

### Split & Combine

```py
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](https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing)
2. [Go Implementation | HashiCorp Vault](https://github.com/hashicorp/vault/tree/main/shamir)
