Skip to content
Adrien Hubert

Shamir secret sharing, k of n.

Two points fix a line, three fix a parabola, k fix a polynomial of degree k minus 1. Adi Shamir turned that into a way to split a secret in 1979: hide it as the constant term of a random polynomial and hand out points on the curve. Any k points rebuild the curve and read the secret off at x = 0. With one point fewer, every possible secret is still equally consistent with what you hold.

UTF-8, up to 64 bytes. Each byte is split on its own.

Shares, tick any of them

Lagrange at x = 0

Each cell is one byte of the reconstruction. Green matches the original, red does not. Below the threshold the interpolation still returns a value. It is just the wrong one, and nothing about it tells you which way to correct it.

Result

The format is the x coordinate in hex, a dash, then one hex byte per secret byte. Copy a few from above, close the page, reopen it, paste them back.

Note

The arithmetic is not over the real numbers. A curve through real points leaks: the shape of a partial set narrows the range of the intercept. Over a finite field there is no shape to read. This page uses GF(256), the field AES also uses, where addition is XOR and multiplication is polynomial multiplication modulo x^8 + x^4 + x^3 + x + 1. Every byte is a field element, so a share is the same length as the secret.

The claim that k minus 1 shares reveal nothing is exact. Fix any k minus 1 points and any candidate value at x = 0. That is k points, and exactly one polynomial of degree below k passes through them. Since the coefficients were drawn uniformly, each candidate is equally likely. That is why the red cells look like noise rather than a near miss.

The randomness comes from crypto.getRandomValues and nothing leaves the browser. I still would not use this page for a real key. The scheme has no integrity check, so a single tampered share yields a confident wrong answer, and an unaudited page written by a model is not where key custody should start. For that, look at audited tools built on the same idea.

Source

Shamir, A. (1979). How to share a secret. Communications of the ACM 22 (11): 612–613.