Skip to main content

Secret Splitter

  • Turn your digital secrets into digital puzzles (literally).
  • Distribute the pieces among a group of people.
  • Anyone can decode the secret by collecting all the pieces back.
  • But if even one piece is missing, all they have is random data.
  • You then trust that group of people to only share their pieces for a good reason.
  • You can add resilience by allowing for some pieces to be missing / corrupt.

Overview (wikipedia)

This module implements:

Splitting

  1. Apply a random mask to the secret
  2. For each block of the mask, generate a polynomial of degree D-1
  3. A piece consists of the masked secret and one point of each polynomial

Recovery

  1. Collect D pieces: D polynomials for each block of the mask
  2. Interpolate the points to retrieve the blocks of the mask
  3. Recover the secret by re-applying the mask to the masked version

Standard piece format

A puzzle piece is a yaml serialisation of the following mapping:

# string, tells if the secret encoded is a string encoded as UTF-8 ("utf-8") or a raw stream of bytes ("none")
encoding: utf-8

# one  puzzle piece, exact format depending on the implementation
# this implementation stores a sequence of [point, value] items, one per block of the secret
# Flow-sequence format preferred to keep it on one line
puzzle piece: [[1,258],[1,3]]

# base64 representation of the result of the mask XOR the byte representation of the secret
encoded secret: YXo=

# name of the algorithm used for splitting
algorithm: block-wise SSS

# different algorithms might add additional information required for recovering the secret.

Installation

  • Using PyPi

    python3 -m pip install secret-splitter

  • From source

    git clone https://git.sr.ht/~retzoh/secret-splitter-py && cd secret-splitter-py && python3 -m pip install .

Usage

  • Command line

    echo "secret" | python3 -m secret_splitter split 3 2 --stdin | python3 -m secret_splitter solve

    See python3 -m secret_splitter --help for all options.

  • Python script

    >>> from secret_splitter import split, solve
    >>> pieces = split('secret', 3, 2)
    >>> secret = solve(pieces)
    

Contibute

Contributions of new algorithms are welcome as long as they pass the test & lint suite.

To add a new algorithm, create src/secret_splitter/algorithm.py and add it to ALGORITHMS in src/secret_splitter/secret_splitter.py.

Install redo and run redo from the root folder to run the tests.

Metadata

Release files for secret-splitter 1.8.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 secret-splitter 1.8.0
File Size Uploaded Provenance Actions
secret_splitter-1.8.0.tar.gz 19.9 kB Without provenance Details for secret_splitter-1.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for secret-splitter 1.8.0
File Interpreter ABI Platform Actions
secret_splitter-1.8.0-py3-none-any.whl Python 3 none any Details for secret_splitter-1.8.0-py3-none-any.whl

Total release size: 32.4 kB

Release files / secret_splitter-1.8.0.tar.gz

Download URL secret_splitter-1.8.0.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ed341fcd1c7794db7bde2f3ea2461079ea9ea8ac92b16f2c39110b761626c319
BLAKE2b-256 checksum
How to use checksums
77ad4aa673e5d4b1ba778be6504f387be4675e0025ee1cd2d1d9724bdd3584b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / secret_splitter-1.8.0-py3-none-any.whl

Download URL secret_splitter-1.8.0-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f224d362d07f5ea0257a7b61e55df8f0eab9b146639f482fdf201d3832d7ee0
BLAKE2b-256 checksum
How to use checksums
d24ba422367051caf375e78b2272b1438cd7ea379b3ce49250c2dc53483ad4f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for secret-splitter 1.8.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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