What does Disaster Recovery and Threshold Shares conclude, in numbers, about “Lagrange Interpolation over a Finite Field: Making, Rebuilding and Checking Shares”?

Answer: Chapter 2 splits and joins in the field modulo 2147483647, proves by exhaustive counting that fewer pieces than the threshold reveal nothing, and shows that locating one crafted bad share costs two units of redundancy.

Scope of the numbers: Chapter 6 computes self-rescue after one share goes missing: losing the fastest holder is like raising the threshold by one, and the illustrative rescue window is 263 hours. Marked boxes separate published evidence, runnable Python calculations (19 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 2147483647

field: integers mod 2147483647 (2^31 - 1)
toy secret 123456, degree-2 polynomial
share x1 y = 422958930
share x2 y = 924162576
share x3 y = 1503734394
share x4 y = 14190737
share x5 y = 750498899
all 10 three-share subsets rebuild 123456: True
10 two-share subsets: a line through them hits 123456 at x0: 0
first two-share guess2069238931

Key formula

\[f(0) = \sum_{i} y_i \prod_{j \ne i} \frac{-x_j}{x_i - x_j} \pmod P.\]
Show the full program
# Chapter 2. p21: split a toy secret 3-of-5 over a prime field, rebuild it.
# Model: Shamir (1979). Field = integers mod the Mersenne prime 2^31 - 1.
# The secret is the toy integer 123456, the constant term of a random
# degree-2 polynomial; share i is the polynomial at x = i. Coefficients
# come from a fixed seed so the run is repeatable. A real deployment uses
# a vetted library and a cryptographic random source, never this demo.
import itertools
import random

PRIME = 2 ** 31 - 1
SECRET = 123456                      # toy value, not a real secret
K, N = 3, 5
rng = random.Random(20261113)


def split(secret, k, n):
    coef = [secret] + [rng.randrange(1, PRIME) for _ in range(k - 1)]
    shares = []
    for x in range(1, n + 1):
        y = 0
        for c in reversed(coef):        # Horner, all mod PRIME
            y = (y * x + c) % PRIME
        shares.append((x, y))
    return coef, shares


def rebuild(points):
    # Lagrange interpolation at x = 0, exact modular arithmetic
    acc = 0
    for i, (xi, yi) in enumerate(points):
        num, den = 1, 1
        for j, (xj, _) in enumerate(points):
            if j != i:
                num = num * (-xj) % PRIME
                den = den * (xi - xj) % PRIME
        acc = (acc + yi * num * pow(den, PRIME - 2, PRIME)) % PRIME
    return acc


coef, shares = split(SECRET, K, N)
print("field: integers mod %d (2^31 - 1)" % PRIME)
print("toy secret %d, degree-%d polynomial" % (SECRET, K - 1))
for x, y in shares:
    print("  share x = %d   y = %10d" % (x, y))
good = [rebuild(list(c)) for c in itertools.combinations(shares, K)]
print("all %d three-share subsets rebuild %d: %s"
      % (len(good), SECRET, all(v == SECRET for v in good)))
two = [rebuild(list(c)) for c in itertools.combinations(shares, K - 1)]
hits = len([v for v in two if v == SECRET])
print("%d two-share subsets: a line through them hits %d at x = 0: %d"
      % (len(two), SECRET, hits))
print("first two-share guess: %d" % two[0])

Single source and citation

Fan, Y. (2026). Disaster Recovery for Digital Assets: Shamir Secret-Sharing Thresholds, Off-Site Incremental Snapshots and Self-Rescue from Single Points of Loss (Version 1.0.0), Chapter 2: Lagrange Interpolation over a Finite Field: Making, Rebuilding and Checking Shares. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-272 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026272,
  author    = {Fan, Yafu},
  title     = {Disaster Recovery for Digital Assets: Shamir Secret-Sharing Thresholds, Off-Site Incremental Snapshots and Self-Rescue from Single Points of Loss},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book