Shamir Secret Sharing Online | Split & Recover Secrets (GF(256))

Password & Security
100% client-side. Processed locally in your browser using the Web Crypto API. Nothing is sent to any server.
⚠️ Critical Security: Fewer than K shares provide ZERO information about the secret — this is information-theoretic security. Always test recovery before distributing shares. Never store multiple shares in the same location.

How It Works

What Is Shamir's Secret Sharing?

Shamir's Secret Sharing is a cryptographic scheme that splits a secret into N shares, where any K (threshold) shares can reconstruct the original via Lagrange polynomial interpolation, but fewer than K shares reveal absolutely nothing. This tool implements the scheme over GF(256) — the same finite field used in AES encryption — providing information-theoretic security stronger than any computational scheme.

All computation runs 100% in your browser using cryptographically secure random bytes (Web Crypto API). Shares are output in "index-hexdata" format (e.g., "1-a3f2b1c4") for easy distribution.

When to Use Shamir's Secret Sharing

  • Cryptocurrency seed backup — Split your BIP39 mnemonic into multiple shares stored in different physical locations
  • Team key management — Require multiple team members to collaborate before accessing critical keys
  • Enterprise key escrow — Distribute master key shares among executives with threshold recovery
  • HSM backup — Protect hardware security module backup keys with threshold schemes
  • Multi-party authorization — Ensure no single person can access sensitive data alone
  • When NOT to use — Don't use for simple password backup; use a password manager instead

Threshold Security Reference

How different (K, N) configurations affect security and recoverability:

Config Security Level Recovery Use Case
2-of-3 Low Easy (any 2 of 3) Simple backup with recovery option
3-of-5 Medium Balanced Family recovery, team key management
5-of-9 High Harder (need 5 of 9) Cryptocurrency seed backup
K-of-N (K>5) Very High Requires majority Enterprise key escrow, HSM backup

Standards Compliance

  • Shamir's Secret Sharing — Original scheme by Adi Shamir (1979)
  • GF(256) Finite Field — Same field used in AES (Rijndael) encryption
  • Web Crypto API — W3C Recommendation for cryptographically secure random generation
  • Lagrange Interpolation — Mathematical foundation for polynomial reconstruction

Last updated:

Code Examples

Implement Shamir's Secret Sharing programmatically:

JavaScript — shamir-secret-sharing library

import { share, combine } from 'shamir-secret-sharing';

const secret = new TextEncoder().encode('my secret');
const shares = share(secret, 3, 5);  // 3-of-5 threshold
console.log('Shares:', shares);

// Recovery with any 3 shares
const recovered = combine(shares.slice(0, 3));
console.log('Recovered:', new TextDecoder().decode(recovered));

Python — secret-sharing library

from secret_sharing import split_and_recover

secret = 'my secret'
shares = split_and_recover(secret, 3, 5)  # 3-of-5 threshold
print('Shares:', shares)

# Recovery with any 3 shares
recovered = split_and_recover(shares[:3])
print('Recovered:', recovered)

Go — hashicorp/vault/shamir

package main

import (
    "fmt"
    "github.com/hashicorp/vault/shamir"
)

func main() {
    secret := []byte("my secret")
    
    // Split into 5 shares with threshold 3
    shares, err := shamir.Split(secret, 5, 3)
    if err != nil {
        panic(err)
    }
    fmt.Println("Shares:", shares)
    
    // Recover from any 3 shares
    recovered, err := shamir.Combine(shares[:3])
    if err != nil {
        panic(err)
    }
    fmt.Println("Recovered:", string(recovered))
}

Rust — shamir-secret-sharing crate

use shamir_secret_sharing::{split, combine};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let secret = b"my secret";
    
    // Split into 5 shares with threshold 3
    let shares = split(secret, 5, 3)?;
    println!("Shares: {:?}", shares);
    
    // Recover from any 3 shares
    let recovered = combine(&shares[..3])?;
    println!("Recovered: {}", String::from_utf8(recovered)?);
    
    Ok(())
}

Node.js — @noble/shamir

const { split, combine } = require('@noble/shamir');

const secret = Buffer.from('my secret');
const shares = split(secret, 5, 3);  // 3-of-5 threshold
console.log('Shares:', shares);

// Recovery with any 3 shares
const recovered = combine(shares.slice(0, 3));
console.log('Recovered:', recovered.toString());

Common Pitfalls & Attack Vectors

⚠️ Storing Multiple Shares Together — If an attacker gains access to K or more shares, they can reconstruct the secret. Always distribute shares to different physical locations and trusted parties.
⚠️ Not Testing Recovery — Always test the recovery process before distributing shares. If shares are corrupted or lost, you may not be able to reconstruct the secret.
⚠️ Using Low Threshold Values — A 2-of-3 scheme is easy to recover but also easier for an attacker to compromise. Use K=ceil(N/2)+1 or higher for balanced security.
⚠️ Transmitting Shares Over Networks — Never send shares over email, chat, or unencrypted channels. Distribute shares physically or use encrypted communication.
⚠️ Assuming Computational Security — Shamir's scheme provides information-theoretic security (unbreakable even with infinite computing power), but only if fewer than K shares are compromised.

Security Notes

🔒 Information-theoretic security — fewer than K shares provide zero information about the secret, regardless of computational power.
🔒 Distribute shares physically — never store multiple shares in the same location or transmit them over the network.
🔒 Use K=ceil(N/2)+1 or higher — ensures no single party can reconstruct alone and majority consensus is required.
🔒 Test recovery before relying on it — always verify you can reconstruct the secret from K shares before distributing them.

Disclaimer

Disclaimer: This page is for educational and testing purposes only. It does not constitute professional security advice. For production secret management, consult dedicated HSM or key management services and conduct a formal security review.

Further Reading & Standards

Related Concepts

Related Tools

Looking for a different approach to secret backup? The BIP39 Mnemonic Validator works with crypto seed phrases. To understand the entropy strength of your secrets, try the Entropy Calculator. For encrypting data before splitting, the AES Encrypt/Decrypt tool adds an extra layer of protection.

Frequently Asked Questions

What happens if I have fewer shares than the threshold?

With fewer than K shares, reconstruction is mathematically impossible. An attacker with K-1 shares gains zero information about the secret — every possible secret of the same length remains equally likely. This is called "information-theoretic security" and is stronger than computational security.

What format are the shares in?

Each share is a string in the format "index-hexdata" (e.g., "1-a3f2b1c4"). The index identifies which share number it is (1 to N), and the hex data is the share value. You can copy all shares at once using the "Copy All Shares" button.

What input encodings are supported?

Three encodings for the secret: plain text (UTF-8), hexadecimal, and Base64. The same encoding must be used for both splitting and combining. Shares are always output in hex format regardless of input encoding.

Is this tool safe for production use?

This tool is designed for learning, experimentation, and generating reference values. The implementation uses cryptographically secure random bytes (Web Crypto API) and a well-known GF(256) field. For production secret management, consider dedicated HSM or key management services.

What threshold (K) should I choose?

It depends on your security requirements. K=2 means any 2 shares can recover (simple recovery, lower security). K=3-of-5 means you need 3 out of 5 shares (balanced). Higher K values increase security but make recovery harder if shares are lost. A common choice is K=ceil(N/2)+1.

Privacy: This tool runs entirely in your browser — nothing is uploaded or stored. · Disclaimer: For educational purposes only. Not professional security advice.

More in Password

Learn More