Skip to main content

PyQuorum

Cryptographic library for secret sharing and key management, powered by Rust

Installation

pip install pyquorum

Quick Start

from pyquorum import ShamirScheme, BlakleyScheme, AdditiveScheme, Shares, generate_key, hkdf

k = 3  # threshold for combine
n = 5  # number of total shares
key = generate_key()  # 32-byte secret

# Shamir and Blakley are threshold schemes: any k of the n shares restore the key
scheme = ShamirScheme(k, n)  # or BlakleyScheme(k, n)
shares = scheme.split(key)
assert scheme.combine(shares) == key

# Additive is n-of-n: every single share is required
additive = AdditiveScheme(n)
additive_shares = additive.split(key)
assert additive.combine(additive_shares) == key

# Derive subkeys from the secret with HKDF (RFC 5869, HMAC-SHA256)
subkey = hkdf(key, 32, salt=b"session", info=b"encryption")

# Shares can be serialized; the index stays the dictionary key
restored = Shares.from_json(shares.to_json())
assert scheme.combine(restored) == key

Security

This library does:

  • generate key
  • split secret
  • combine secret

What it doesn't:

  • replace encryption packages like cryptography, pyserpent and etc

WARNING - This library is in active development (0.x.x). It has not undergone a professional security audit and contains known vulnerabilities. Do not use in production.

You can review known vulnerabilities in SECURITY_ISSUES_TRACKER.md

If you found a security issue, please refer to SECURITY.md

Roadmap to v1.0.0

  • - Shamir Scheme
  • - Blakley Scheme
  • - Additive Scheme
  • - HKDF Key Derivation
  • - Threshold ECDSA

Support

If you find this package usefull, you can star repo on github

Theory

Shamir Scheme Share

How to split a secret key

Shamir split diagram

How to combine a secret key

Shamir combine diagram

Example

Source secret key

Spliting secret key to 5 shares

Combining 3 shares to secret key

Result

Blakley Scheme Share

How to split a secret key

Blakley split

How to combine a secret key

Blakley combine

Example

Spliting secret key to 4 shares

Combining 3 shares to secret key

Additive Scheme Share

Every share is a uniformly random byte string of the same length as the secret, and the last share is the xor of the secret with all the others. The scheme is therefore n-of-n: any n-1 shares are independent of the secret, and all n are required to restore it. Shares are combined with xor in GF(2^256), so the split is exact and needs no modular arithmetic.

scheme = AdditiveScheme(3)
shares = scheme.split(key)   # "1:<hex>", "2:<hex>", "3:<hex>"
assert scheme.combine(shares) == key

HKDF Key Derivation

hkdf(ikm, length, salt=b"", info=b"") implements HKDF (RFC 5869) with HMAC-SHA256 and matches the RFC SHA-256 test vectors. length is the number of output bytes and must be in 1..255*32; a missing or empty salt means the RFC default of HashLen zero bytes.

subkey = hkdf(key, 64, salt=b"session-1", info=b"aes-key")

Metadata

Release files for pyquorum 0.3.0

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

Source distribution (sdist)

Source distribution for pyquorum 0.3.0
File Size Uploaded
pyquorum-0.3.0.tar.gz 14.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyquorum 0.3.0
File Interpreter ABI Platform
pyquorum-0.3.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
pyquorum-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
pyquorum-0.3.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64 Details

Total release size: 806.3 kB

Release files / pyquorum-0.3.0.tar.gz

Download URL pyquorum-0.3.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4248c0e3157fd35d35291708b7bcf07af45f5a1e6bcccde636b25e6452875127
BLAKE2b-256 checksum
How to use checksums
82094e948cc1fbbe23ef592916e58edf34a1741d04a37fbaf02085b8ecc778eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / pyquorum-0.3.0-cp39-abi3-win_amd64.whl

Download URL pyquorum-0.3.0-cp39-abi3-win_amd64.whl
Size 137.7 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f202917212949efe9e7e5b0df7fb6038cfdb1bba7bc01d6d169c1c078c068776
BLAKE2b-256 checksum
How to use checksums
7fdcb8fdd128053e35f7baa2a92d3d6f8a633cc37e16f796574f48ff282383ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / pyquorum-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL pyquorum-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl
Size 241.5 kB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
ad3dc6d7ecfd155ce91b99138c5938ffe25c6a7abcdb0778c281d9415de330e0
BLAKE2b-256 checksum
How to use checksums
0fd59ea1bacc6bebf3ec0457f8610c0dc2be32f5263e6062d8e608161b9fd451
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / pyquorum-0.3.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL pyquorum-0.3.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 412.7 kB
Tags CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bfa99ee9b673244bc54882b04e7a702b075e06d66f842e356989014a3d938109
BLAKE2b-256 checksum
How to use checksums
da127b6660363cdb35f74394b574bd28b13c8f30f19bc36322813e2de00d660f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

4 release files

0.2.1

4 release files

0.2.0

4 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