关于「有限域上的拉格朗日插值:分片如何生成、还原与验错」,《数字资产灾难恢复与门限分片》给出的定量结论是什么?
结论:第二章在模 2147483647 的域上分与合,并穷举证明不足门限的份不泄露信息;定位一份精心构造的坏份需要两份冗余。
数据口径:书中所有秘密都是玩具整数,参数均为示意,全部计算由书中程序生成;本书是数学模型与演练清单,不连接也不描述任何真实服务器,生产环境的备份与密钥操作须人工放行,不构成个人化法律或理财建议。 第一章在每份每年丢失 0.05、泄露 0.02 的示意参数下,算出三份副本的年丢失概率 0.000125、泄露概率 0.058808,三取二分别为 0.007250 与 0.001184,五取二是两项都胜过三份副本的最小方案。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 2147483647
| field: integers mod 2147483647 (2^31 - 1) | |
| toy secret 123456, degree-2 polynomial | |
| share x | 1 y = 422958930 |
| share x | 2 y = 924162576 |
| share x | 3 y = 1503734394 |
| share x | 4 y = 14190737 |
| share x | 5 y = 750498899 |
| all 10 three-share subsets rebuild 123456: True | |
| 10 two-share subsets: a line through them hits 123456 at x | 0: 0 |
| first two-share guess | 2069238931 |
核心公式
\[f(0) = \sum_{i} y_i \prod_{j \ne i} \frac{-x_j}{x_i - x_j} \pmod P.\]
查看完整验算程序
# 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])唯一数据源与引用
范雅福(Fan, Y.). (2026). 《数字资产灾难恢复与密钥分片、沙米尔秘密共享门限与异地增量快照单点失联自救母典》第 2 章「有限域上的拉格朗日插值:分片如何生成、还原与验错」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 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}
}