Shamir Secret Sharing Online | Split & Recover Secrets (GF(256))
Password & Security 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
Security Notes
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
- Shamir's Original Paper — How to Share a Secret (1979)
- GF(256) Finite Field Arithmetic — Wikipedia: Finite Field Arithmetic
- Lagrange Interpolation — Mathematical Foundation
- BIP39 Mnemonic Phrases — Bitcoin Improvement Proposal 39
Related Concepts
- BIP39 Mnemonic Phrases — How cryptocurrency wallet seeds work and why they're popular for backup
- Key Management — Best practices for storing and protecting cryptographic keys
- Certificate Signing Requests — How PKI infrastructure uses key pairs
- Post-Quantum Cryptography — Future-proofing your secrets against quantum attacks
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
Password Generator
Generate secure random passwords online with customizable length, character types, symbols, and exclusion rules. Quick presets available.
Password Strength Checker
Check password strength and estimate crack time online. zxcvbn-based entropy analysis, multiple attack scenarios, and pattern recognition.
Passphrase Generator
Generate strong passphrases from random dictionary words online. EFF wordlist, configurable separators, and color-coded strength.
Entropy Calculator
Calculate password and passphrase entropy online. Crack time estimates, character pool analysis, and strength ratings.
KDF Hash Generator
Derive cryptographic keys using PBKDF2, Argon2, or Scrypt online. OWASP 2024 parameters, PHC output, adjustable iterations and memory.