Skip to main content

Human-executable secret sharing for BIP39 mnemonics using GF(2053)

Project description

schiavinato-sharing-py

Python library for Schiavinato Sharing

Human-executable secret sharing for BIP39 mnemonics using GF(2053).

PyPI version Python versions License: MIT


โš ๏ธ Status: Work in Progress

This library is functional but experimental (v0.4.1).

It is not professionally audited. Do not use for real funds until you have done your own review and the project has undergone independent security review.

Current Status

  • Core GF(2053) arithmetic, polynomial ops, Lagrange interpolation
  • BIP39 mnemonic split/recover with row + global checksums
  • v0.4.1 parity with JS: dual-path checksum validation, checksum polynomials, security utilities, configurable randomness, and mnemonic helpers
  • Comprehensive test suite (62 tests) with cross-implementation vectors

๐ŸŽฏ What is Schiavinato Sharing?

Schiavinato Sharing is a secret-sharing scheme specifically designed for BIP39 mnemonic phrases using basic arithmetic in GF(2053). Unlike other schemes, it can be performed entirely by hand with pencil and paper, making it ideal for:

  • ๐Ÿฆ Long-term inheritance planning
  • ๐Ÿ” Disaster recovery scenarios
  • ๐ŸŒ Situations where digital tools are unavailable or untrusted
  • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Family backup strategies

๐Ÿ“ฆ Installation

pip install schiavinato-sharing

๐Ÿš€ Quick Start

Splitting a Mnemonic

from schiavinato_sharing import split_mnemonic

mnemonic = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'
k = 2  # threshold
n = 3  # total shares

shares = split_mnemonic(mnemonic, k, n)
print(shares[0].share_number)
print(shares[0].word_shares[:3])
print(shares[0].checksum_shares)
print(shares[0].global_integrity_check_share)

Recovering a Mnemonic

from schiavinato_sharing import recover_mnemonic

result = recover_mnemonic(shares[:2], word_count=12, strict_validation=True)
if result.success:
    print(result.mnemonic)
else:
    print(result.errors)

๐Ÿ“š Documentation

Specification

This library implements the Schiavinato Sharing specification:

๐Ÿ”— Specification Repository

Key documents:

Sister Implementation

The JavaScript library is the primary implementation for end users:

๐Ÿ”— JavaScript Library

npm install @grifortis/schiavinato-sharing

๐Ÿงช Development

Setup

# Clone the repository
git clone https://github.com/GRIFORTIS/schiavinato-sharing-py.git
cd schiavinato-sharing-py

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Type checking
mypy schiavinato_sharing

# Linting
ruff check .

# Formatting
black .

Project Structure

schiavinato-sharing-py/
โ”œโ”€โ”€ schiavinato_sharing/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ field.py              # GF(2053) field arithmetic
โ”‚   โ”œโ”€โ”€ polynomial.py         # Polynomial operations
โ”‚   โ”œโ”€โ”€ lagrange.py           # Lagrange interpolation
โ”‚   โ”œโ”€โ”€ split.py              # Mnemonic splitting
โ”‚   โ”œโ”€โ”€ recover.py            # Mnemonic recovery
โ”‚   โ”œโ”€โ”€ checksums.py          # Checksum generation/validation
โ”‚   โ”œโ”€โ”€ security.py           # Constant-time comparisons + best-effort wiping
โ”‚   โ”œโ”€โ”€ seed.py               # Mnemonic helpers + native BIP39 checksum validation
โ”‚   โ””โ”€โ”€ types.py              # Dataclasses and typed error shape
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

๐Ÿค Contributing

We welcome contributions! This project is in early development, so there's plenty to do.

How to Help

  • ๐Ÿ Implement core functionality โ€“ Help write the library!
  • ๐Ÿงช Write tests โ€“ Ensure correctness with comprehensive tests
  • ๐Ÿ“– Documentation โ€“ Improve README, docstrings, examples
  • ๐Ÿ” Review โ€“ Check for bugs, security issues, or improvements

Getting Started

  1. Read the spec: Schiavinato Sharing Whitepaper (LaTeX source)
  2. Check test vectors: TEST_VECTORS.md
  3. Look at JS implementation: schiavinato-sharing-js for reference
  4. Open an issue: Discuss your contribution before starting

See CONTRIBUTING.md for detailed guidelines.


๐Ÿ”’ Security

Security Status: โš ๏ธ EXPERIMENTAL (Not Audited)

This library is experimental software that has NOT been professionally audited.

DO NOT USE FOR REAL FUNDS until:

  • Professional security audit
  • Extensive peer review
  • v1.0.0 release

See SECURITY.md for reporting vulnerabilities.


๐Ÿ“„ License

MIT License โ€“ see file for details.


๐Ÿ”— Related Projects


๐Ÿ“ฌ Contact


๐Ÿ™ Acknowledgments

This implementation is based on:

  • Shamir, A. (1979). "How to Share a Secret"
  • BIP39: Mnemonic code for generating deterministic keys
  • The Schiavinato Sharing specification by Renato Schiavinato Lopez, creator of Schiavinato Sharing and founder of GRIFORTIS

Made with โค๏ธ by GRIFORTIS

Empowering digital sovereignty through open-source tools.

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

schiavinato_sharing-0.4.1.tar.gz (29.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schiavinato_sharing-0.4.1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file schiavinato_sharing-0.4.1.tar.gz.

File metadata

  • Download URL: schiavinato_sharing-0.4.1.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for schiavinato_sharing-0.4.1.tar.gz
Algorithm Hash digest
SHA256 9f4c08fb38d692c2a5f23ae2f3d3d8ca83026fc23aa6bcb134eb5c403016797e
MD5 2ed1bc8c49b76d80d6a1cdc7ec1ac6dd
BLAKE2b-256 01729c759fc10db79a6b4236f8223fdc65f6394782c3a7bd057f915b08610b17

See more details on using hashes here.

Provenance

The following attestation bundles were made for schiavinato_sharing-0.4.1.tar.gz:

Publisher: publish.yml on GRIFORTIS/schiavinato-sharing-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file schiavinato_sharing-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for schiavinato_sharing-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4bb1cde1169fe47008e88bd5a039e714431321d150109f0c75790e88a74fbbf7
MD5 a8861c13dd902f818c32628026efd680
BLAKE2b-256 92150a2b4efaa58b5e5cee7d707aaf0e329e1062e3dc8ba3e9acb977093ff75b

See more details on using hashes here.

Provenance

The following attestation bundles were made for schiavinato_sharing-0.4.1-py3-none-any.whl:

Publisher: publish.yml on GRIFORTIS/schiavinato-sharing-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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