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.2.tar.gz (98.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: shamir_ss-0.2.2.tar.gz
  • Upload date:
  • Size: 98.7 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.2.tar.gz
Algorithm Hash digest
SHA256 e5965d922b085902c3673b8e0eeb7ade317bf4f076535e91a82a5cf8de4266cc
MD5 b1a251a3061d0f4da014bdd55cd252d3
BLAKE2b-256 1670f4572f8e391e2a5c55df1b5425fcb165e2bb9e6d6bb0439656b3dc94dbb0

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