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.0).

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.0 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.0.tar.gz (28.2 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.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: schiavinato_sharing-0.4.0.tar.gz
  • Upload date:
  • Size: 28.2 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.0.tar.gz
Algorithm Hash digest
SHA256 a26bc16ff34aff94905eec4af78b5ba5fb7837944de8d5f397bc8066a5425d33
MD5 2f8f8045cb1254ba63d248c2c067f634
BLAKE2b-256 e63fae7dedba5a6077162ca7e84161878b2a6a2aba54cf0d807f57dea29c5f22

See more details on using hashes here.

Provenance

The following attestation bundles were made for schiavinato_sharing-0.4.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for schiavinato_sharing-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6620129729ce1eb88d1fbaf520a21fc23a1f7eff576199e27e3a1fa4a93812b3
MD5 0901ce655a8ee89828f28a759327cb2f
BLAKE2b-256 d58945851c33c61bdfd987ed4b90d32ad82f748b4b2fdd5f37fe4c591ce0b6d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for schiavinato_sharing-0.4.0-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