K070 / Advanced and next-generation cryptography
Shamir Secret Sharing
A threshold secret-sharing scheme distributing secret D into n shares and reconstructing it from at least k shares.
CRYPTOGRAPHY LAB / K070
Cryptography Lab · Shamir Secret Sharing
Run real computations and inspect intermediate states step by step.
Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.
Shamir (3 of 5, GF(257))
See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.Output
Previous state
- Definition and overview
- A threshold secret-sharing scheme distributing secret D into n shares and reconstructing it from at least k shares. Source document ↗
- Classification and reversibility
- Threshold secret sharing; k shares reconstruct secret, k−1 or fewer reveal no information. Source document ↗
- Key or secret requirements
- Requires secret to reconstruct; examples use 16/32-byte key bytes. Source document ↗
- Operating principle and structure
- Degree k−1 polynomial with constant f(0) as secret; shares are points (x,f(x)); interpolate from k points. Source document ↗
- Key size, block size and parameters
- Implementation parameters parts/threshold 2 to 255; share one byte longer than secret. Source document ↗
- Security strength and recommendation
- Information-theoretic security: fewer than threshold shares disclose no secret information. Source document ↗
- Known attacks and vulnerabilities
- Threshold-signature implementation vulnerabilities reportedly allow malicious participants to steal others' keys or disrupt nodes. Source document ↗
- Standards and certification
- NIST threshold cryptography standardization exists; excerpt does not establish a finalized SSS standard/certification. Source document ↗
- Typical uses
- Robust cryptographic key management through distributed storage/recovery. Source document ↗
- Implementations, libraries and tools
- TypeScript and other implementations/libraries. Source document ↗
- Decryption or decoding
- Combine at least k distinct shares using combine/DecodeSecret to reconstruct secret. Source document ↗
- Advantages
- Minimality: shares need not exceed original secret size in theory. Source document ↗
- Limitations and cautions
- General threshold secret sharing is simple to define but complex to deploy/configure. Source document ↗
- Distinguishing encryption, encoding and hashing
- SSS reconstructs secret/key rather than decrypting ciphertext; actual decryption is separate. Source document ↗
Practical examples
Example
Split secret S into n distributed shares; combine k distinct shares to recover S. Use reconstructed S for separate decryption if needed; no real keys in examples.
Procedure
Split: input secret, choose k,n, generate polynomial, distribute shares. Recover: collect k or more distinct shares, interpolate polynomial, reconstruct secret. SSS produces neither ordinary ciphertext nor encoded string; use recovered secret for separate operations.
Scenario
Distribute shares to multiple administrators for backup/disaster recovery upon k approvals. Also key management for threshold signatures/encryption; account for implementation flaws and share integrity verification.
Pitfalls and alternatives
Below k no recovery/information in principle; implementation defects, side channels and corrupted shares remain risks. Not encryption/hash; use audited libraries, checksums/verification and secure share channels, protect reconstructed secret via AEAD etc.
References
- How to share a secret ↗
- Secret Sharing Schemes - PyCryptodome ↗
- Shamir's Secret Sharing: Interactive Visualizer ↗
- shamir/shamir.go ↗
- Shamir's secret sharing ↗
- Disclosing Shamir’s Secret Sharing vulnerabilities and announcing ZKDocs - The Trail of Bits Blog ↗
- Introduction ↗
- privy-io/shamir-secret-sharing ↗
- README.md ↗
- Practice Based Recommendations for Standardization of Threshold Cryptography ↗
- Shamir's Secret Sharing - Documentation ↗