Skip to main content

Python library with a minimal native implementation of Shamir's Secret Sharing algorithm.

Project description

Python library with a minimal native implementation of Shamir’s Secret Sharing algorithm.

PyPI version and link.

Purpose

The library provides functions for computing secret shares given an integer input value, as well as for reassembling an integer from its corresponding shares using Lagrange interpolation over finite fields. The native python random.randint function is used to generate the polynomial when creating shares.

Package Installation and Usage

The package is available on PyPI:

python -m pip install shamirs

The library can be imported in the usual way:

import shamirs

Examples

The library provides functions for splitting a value into a number of shares across a number of parties, and for reassembling those share back into the value they represent:

>>> shares = shamirs.share(5, 3, 17)
>>> shamirs.build(shares, 17)
5
>>> shamirs.build(shamirs.share(123, 12, 15485867), 15485867)
123

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

shamirs-0.1.0.0.tar.gz (2.0 kB view hashes)

Uploaded Source

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