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