关于「出处哈希:把事实钉成可以逐字节比对的原子」,《衍生品的出处与保真》给出的定量结论是什么?

结论:第二章把事实写成四字段原子,用规范化 SHA-256 哈希、足够长的前缀与默克尔根做比对。

数据口径:书中参数为示意,代价用记账点数而非价格;全部计算由书中程序生成。 书中以标注框区分已发表的证据、可运行的 Python 计算(19 段程序)、原典与作者的假说。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库

master canonical hash 02104f49279d
variant raw-hash same canon-hash same
same atom02104f49279d yes02104f49279d yes
extra spaces b711e77fbb8d NO02104f49279d yes
upper case6d8d65b116f4 NO02104f49279d yes
full-width0675e345c1ba NO02104f49279d yes
trailing 0f58ef862d922 NO02104f49279d yes
roundedc16c144cc6f0 NOc16c144cc6f0 NO
digit slip39ef52e68f43 NO39ef52e68f43 NO
unit swap267939d9f614 NO267939d9f614 NO
查看完整验算程序
# Chapter 2. p21: hash a canonical fact atom, not the raw sentence.
# An atom is "subject | relation | value | unit". Canonical form: NFKC
# (full-width digits become ASCII), lower case, single spaces, and the
# value written as a normalised decimal (0.30 and 0.3 are one value).
# SHA-256 of the canonical form is the atom's provenance hash; the
# first 12 hex digits are shown. Example atoms are illustrative and the
# hashes are computed in memory only; nothing is read from disk.
import hashlib
import unicodedata
from decimal import Decimal


def canon(subject, relation, value, unit):
    parts = []
    for s in (subject, relation, unit):
        s = unicodedata.normalize("NFKC", s).lower()
        parts.append(" ".join(s.split()))
    v = unicodedata.normalize("NFKC", value).strip()
    v = format(Decimal(v).normalize(), "f")
    return "%s|%s|%s|%s" % (parts[0], parts[1], v, parts[2])


def h(text):
    return hashlib.sha256(text.encode("utf-8")).hexdigest()[:12]


MASTER = ("serial recall", "share kept after 3 layers", "0.8574",
          "fraction")
VARIANTS = [
    ("same atom", MASTER),
    ("extra spaces", ("serial  recall ", "share kept after 3 layers",
                      "0.8574", "fraction")),
    ("upper case", ("Serial Recall", "Share kept after 3 layers",
                    "0.8574", "Fraction")),
    ("full-width", ("serial recall", "share kept after 3 layers",
                    "\uff10.\uff18\uff15\uff17\uff14", "fraction")),
    ("trailing 0", ("serial recall", "share kept after 3 layers",
                    "0.85740", "fraction")),
    ("rounded", ("serial recall", "share kept after 3 layers",
                 "0.86", "fraction")),
    ("digit slip", ("serial recall", "share kept after 3 layers",
                    "0.8547", "fraction")),
    ("unit swap", ("serial recall", "share kept after 3 layers",
                   "0.8574", "percent")),
]
raw0 = h("|".join(MASTER))
can0 = h(canon(*MASTER))
print("master canonical hash %s" % can0)
print("%-12s %-12s %-4s %-12s %-4s" % ("variant", "raw-hash", "same",
                                        "canon-hash", "same"))
for name, atom in VARIANTS:
    r = h("|".join(atom))
    c = h(canon(*atom))
    print("%-12s %-12s %-4s %-12s %-4s" % (
        name, r, "yes" if r == raw0 else "NO", c,
        "yes" if c == can0 else "NO"))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《母书多模态衍生编译与版权链、单部专著到播客投影片题库的结构同态流水线母典》第 2 章「出处哈希:把事实钉成可以逐字节比对的原子」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-268 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026268,
  author    = {Fan, Yafu},
  title     = {Multimodal Derivative Compilation and Provenance Chains: A Structure-Preserving Pipeline from One Monograph to Podcasts, Slides and Quiz Banks},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论