JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
Back to the library
密码学 1979

保密、认证与公钥系统

拉尔夫·默克尔

用一个指纹为整棵数据之树作担保——任何篡改都逃不过。

Choose your version
In depth · the introduction

一种办法:把一整座数据的图书馆,浓缩成一个简短的指纹——却仍能证明其中任何一页确实在里面。

核心想法

假设你想为一百万条记录作担保,又不想把这一百万条全交出去。默克尔的妙招是:把每条记录哈希成一个简短的指纹,再把指纹两两哈希在一起,然后是「对的对」,如此层层向上,直到一切汇聚成顶端唯一的一个指纹——根。这一个值,悄悄地依赖于它下面的每一条记录。

如今,任何知道根的人,都能只沿着「从那条记录一路向上到顶端」的路径,每一步收集一个「伙伴」指纹,来核验单独一条记录。区区几个指纹——而非整堆——就足以证明这条记录确实在册、且未被动过。哪怕在任何地方改动一个字符,根都会不再相符。

它是如何诞生的

1970 年代中期,拉尔夫·默克尔还是伯克利的一名本科生,他提出了一个当时被视为异端的想法:两个人,可以在一条所有人都能听到的线路上,约定一个秘密。一家期刊以「太过偏离主流」为由拒了这篇论文。大约在同一时期,惠特菲尔德·迪菲与马丁·赫尔曼也得出了相关的结论,公钥密码学,便诞生于这三人之手。

默克尔把这项工作带进了他 1979 年完成的斯坦福博士论文。在那里,为了让数字签名切实可用,他发明了那棵如今以他为名的哈希树——一段安静的「管道」,它将为等到自己的时刻,沉睡三十年。

它为何重要

在网络上,信任通常意味着信任一家大机构替你把账记对。默克尔树提供了另一种信任:你只留着一个小小的指纹,而数学让你能拿任何一片庞大数据集去与它比对——既廉价,又哪怕这数据是从你并不信任的人那里拿来的也无妨。正是这一招——不必重新下载整体,就能核验局部——让手机能核验比特币支付,让 Git 能判断一个文件是否被改动,也让浏览器能抓出伪造的安全证书。

一个可以想象的画面

把它想成一场淘汰赛的对阵表,只不过比的是指纹。每条记录都参加第一轮,赢得一个指纹;胜者的指纹被合成下一轮的指纹,如此一路向上,直到顶端只剩一位冠军。要证明你的记录进了这场比赛,你不必重打每一场——只需沿着你自己那条分支,把一路到冠军的赛果亮出来即可。倘若有人调包了你的记录,这串赛果,便不会再通向同一位冠军。

一棵四笔交易的可交互默克尔树:每笔成为一片叶子指纹,成对向上合并,汇成顶端唯一的根指纹;改动任何一笔交易,它的叶子、以及直到根的每一个指纹都会重新着色,根也随之改变,由此显出:单处篡改,一次比对即可抓出;点一片叶子,会高亮证明它「在册」的那两个伙伴指纹。

它的位置

默克尔树,是那套悄悄运行着互联网的密码学的一条腿,与本馆别处的迪菲–赫尔曼密钥交换、RSA 并列。三十年间,这棵哈希树,一直是个低调好用的工具;后来,中本聪的比特币(同样收录于本馆)在每个区块的头部都放进了一个默克尔根,一夜之间,默克尔 1979 年的这套构造,便被以每天数十亿次的频率计算着。它是「基础研究等待数十年才迎来时机」的一个干净例证。

The original document
Original source text
Ralph C. Merkle · “Secrecy, Authentication, and Public Key Systems” · Ph.D. dissertation, Stanford University · 1979
The problem
Merkle's thesis gathers the work that, alongside Diffie and Hellman, opened public-key cryptography: how two strangers can agree on a shared secret over a channel an eavesdropper can hear, and how a message can be signed so that anyone may verify it yet no one can forge it.
One-time signatures
One building block is the Lamport–Diffie one-time signature, which signs a single message by revealing pre-images of a one-way function. It is secure but wasteful: each public key can be used only once, so signing many messages means publishing — and somehow trusting — a long list of public values.
Tree authentication
Merkle's remedy is to place the many public values at the leaves of a binary tree and label every internal node with the hash of its two children. The single value at the top — the root — then commits to all the leaves at once. To prove one leaf is genuine, you reveal only that leaf together with the sibling hash at each level on the way up: about log₂n values, however many leaves there are. Recomputing the hashes along that path must reproduce the published root, or the leaf is rejected.
This is the structure now called a Merkle tree (or hash tree). It turns the authentication of arbitrarily many items into the storage of one root hash plus a short, checkable path per item.
[ … ]
The dissertation develops these ideas in full — one-way functions, the puzzle method for public-key distribution, the one-time signature, and the tree of one-time signatures — across its chapters; the complete text is at the source below.
Ralph C. Merkle · Stanford University · 1979