Skip to main content

Shamir's Secret Sharing implementation using Cython

Project description

Tests PYPI versions

Shamir Secret Sharing (SSS)

Secure cryptographic implementation of Shamir's Secret Sharing scheme for splitting secrets into multiple shares. Designed for both short secrets and large text/data with automatic chunking.

Features

  • 🔒 Cryptographic security using Mersenne prime modulus (2¹²⁷-1)
  • 📦 CLI interface and Python API
  • ✨ Automatic chunking for large secrets
  • 🚀 Cython-optimized core implementation
  • ✅ Hash-based secret integrity verification

Installation

pip install shamir_ss

Development

For developement see following guide

Python API

Example

from shamir_ss import generate_text_shares, reconstruct_text_secret

def main():
    secret = "My top secret"

    shares = generate_text_shares(secret, 3, 5)

    reconstructed = reconstruct_text_secret(shares[:3])
    print(reconstructed)

if __name__ == "__main__":
    main()

CLI Application

Features

  • 🔐 Interactive secret input with hidden typing
  • 📁 Multiple input formats (files/directories/text)
  • 🛡️ SHA-256 hash verification
  • 🔄 Automatic share validation

Usage

python -m shamir_ss <command> <...args>

Command list

shamir_ss --help         # Show all commands
shamir_ss split --help   # Split command help
shamir_ss combine --help # Combine command help
shamir_ss help           # Detailed usage examples

Examples

python -m shamir_ss split \
  --secret "My top secret" \
  -t 3 -n 5 \
  --output shares

Split secret to 5 shares with treshold 3 and put output to shares dir

python -m shamir_ss combine \
  -i shares

Reconstruct secret from shares dir w/o hash validation (will be prompted interactively)

shamir_ss combine --text

Reconstruct secret using interactive mode

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

shamir_ss-0.2.3.tar.gz (107.0 kB view details)

Uploaded Source

File details

Details for the file shamir_ss-0.2.3.tar.gz.

File metadata

  • Download URL: shamir_ss-0.2.3.tar.gz
  • Upload date:
  • Size: 107.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for shamir_ss-0.2.3.tar.gz
Algorithm Hash digest
SHA256 7602ff00060847515d9626a3f7399725ce03187010d4c72c8606000b10567602
MD5 1963c86238c509ff0f92981fdbfe30be
BLAKE2b-256 92e4d0d4ba0ebff8df7aaae653f7a4a2882b91ad6b9800c441ca53b975659985

See more details on using hashes here.

Supported by

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