b2KIT

Shamir Secret Sharing Tool

Split a secret into N shares where any K shares can reconstruct it. Uses polynomial interpolation over a finite field.

Tested tool guide Tested browser tools Checked August 16, 2026

What Shamir Secret Sharing Tool does, with a checked example

This tool splits a secret into N shares and rebuilds it from any K of them, where K (the threshold) is at most N. It encodes the secret as the constant term of a random polynomial of degree K-1 over a finite field, then gives each share one point on that curve; interpolating any K points recovers the polynomial, and its constant term is the secret. The surprise is that K-1 shares reveal nothing at all, not even a partial guess, because every possible secret remains equally plausible. The common mistake is treating shares as fragments that leak bits, or assuming all N shares are required.

Worked example

A concrete input and expected output from the current implementation.

Input

Secret: 1234, N (shares): 5, K (threshold): 3, prime: 1613

Expected output

1: 1494
2: 329
3: 965
4: 176
5: 1188

Each share is one point on the polynomial f(x) = 1234 + 166x + 94x^2 evaluated modulo the prime 1613, whose constant term is the secret. The coefficients 166 and 94 are drawn at random, so a real run will differ; the arithmetic shown is fixed, and any three of the five points, for example (1, 1494), (2, 329), (3, 965), reconstruct 1234 by Lagrange interpolation.

How the result is produced

1

How the shares are made

Enter the secret, the number of shares N, and the threshold K. The scheme needs a finite field, so all arithmetic happens modulo a large prime. The tool builds a polynomial of degree K-1 whose constant term is the secret; the other K-1 coefficients are chosen at random. Evaluating it at N distinct x-coordinates (typically 1 through N) yields the N shares, each an (x, y) pair.

2

How the secret comes back

Enter any K of the N shares. A polynomial of degree K-1 is uniquely determined by K points, so the tool fits the unique curve through them via Lagrange interpolation, reads the constant term, and converts it back to the original text or number. Which K shares you choose makes no difference: any combination of K points determines the same polynomial, so the secret comes out identical.

Good uses

  • Recover a master password or a crypto wallet's recovery phrase: split it into five shares, keep two yourself, and entrust one to each of three people, so any three of the five can restore it while no single holder can.
  • Quorum control of a shared credential, such as a company vault password or a signing key: K of N senior staff must cooperate to decrypt it, so one compromised machine or account is not enough to expose the key.
  • Incident escrow for API keys or access tokens: distribute shares to a fixed team of operators so a defined quorum can take over an account after an emergency, while fewer than K members can never act alone.

Limits and checks

  • Sharing the same secret twice yields a completely different share set, because the coefficients are random per run. Trust only the shares from one run, and never mix shares from different runs.
  • The threshold is the security setting: with K = N every share is mandatory and losing one destroys the secret permanently, while with K = 1 any single share alone reveals the whole secret. Choose K deliberately.
  • A single altered or mistyped share silently produces a wrong secret, since any K points still define some polynomial. Keep the index with its value, paste shares exactly as printed, and test reconstruction before you rely on it.

Common questions

If I have only K-1 shares, can I still recover the secret?

No. Shamir sharing is information-theoretically secure: with K-1 shares, every candidate secret is exactly as plausible as every other, so no amount of computation or guessing changes anything. Your only options are obtaining the missing share or, if you still have the original secret, re-sharing it and distributing a fresh set.

If I share the same secret twice, do I get the same shares?

No. Each run picks fresh random coefficients, so the same secret produces a completely different share set, and you cannot mix shares from two runs. If a share is lost before you need the secret, re-share and redistribute rather than guessing. The tool runs entirely in your browser, so the secret and its shares never leave your machine.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools