# 一次性密码本

一次性密码本（one-time pad，OTP）是一种加密方法，将明文与一个等长的秘密随机密钥相结合，密钥仅使用一次即被丢弃，最常用的方式是按位异或。当密钥真正随机、从不重复使用且保持秘密时，密文除长度外不泄露明文的任何信息，这一性质称为完善保密性。<sup>[1](https://www.teach.cs.toronto.edu/~csc110y/fall/notes/08-cryptography/02-one-time-pad.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 运算方式 | 加密为 \( c = k \oplus m \)，解密为 \( m = k \oplus c \)，密钥、明文和密文均为等长字符串<sup>[2](https://securitybook.eecs.berkeley.edu/chapters/lec08.html)</sup> |
| 安全性保证 | 完善保密性，由克劳德·香农于1949年命名：密文除长度外不泄露明文的任何信息，即使面对拥有无限计算能力的攻击者亦然<sup>[1](https://www.teach.cs.toronto.edu/~csc110y/fall/notes/08-cryptography/02-one-time-pad.html)</sup><sup> • </sup><sup>[2](https://securitybook.eecs.berkeley.edu/chapters/lec08.html)</sup> |
| 密钥要求 | 密钥必须真正随机、至少与消息等长、仅使用一次，且仅为发送方和接收方所知<sup>[3](https://www.cia.gov/legacy/museum/artifact/one-time-pads/)</sup> |
| 起源 | 美国电话电报公司的吉尔伯特·弗纳姆于1917年发明了一次性纸带电传打字机密码；约瑟夫·O·莫博恩于1919年完善了一次性密码本系统，与弗纳姆并列为共同发明人<sup>[4](https://www.nsa.gov/History/Cryptologic-History/Historical-Events/Historical-Events-List/)</sup><sup> • </sup><sup>[5](https://www.nsa.gov/press-room/digital-media-center/biographies/biography-view-page/article/3903416/mg-joseph-o-mauborgne-usa/)</sup> |
| 实践中的主要弱点 | 密钥材料的重复使用：若两条消息共用同一密钥，则 \( c_1 \oplus c_2 = m_1 \oplus m_2 \)，会泄露两条明文的信息<sup>[2](https://securitybook.eecs.berkeley.edu/chapters/lec08.html)</sup> |
| 其他局限 | 不提供完整性保护（方案具有可延展性），且密钥必须通过独立的安全信道分发<sup>[6](https://staff.ie.cuhk.edu.hk/~smchow/4150/)</sup> |
| 现代应用场景 | 量子密钥分发系统常与一次性密码本加密配合用于极高保证级别的链路，但密钥速率限制了吞吐量<sup>[7](https://www.enisa.europa.eu/sites/default/files/publications/Briefing_Quantum_Key_Distribution.pdf)</sup> |

## 工作原理

在当今使用的二进制形式中，密钥、明文和密文是等长字符串，加密仅需一次异或运算：\( c = k \oplus m \)。解密施加相同的运算，因为 \( k \oplus (k \oplus m) = m \)。<sup>[2](https://securitybook.eecs.berkeley.edu/chapters/lec08.html)</sup> 面向字符的描述方式原理相同，即按不同幅度移位每个明文字符，例如 \( (m[i] + k[i]) \bmod 128 \)，因此移位量随位置而变化，而非像[凯撒密码](https://www.edgepedia.org/zh/caesar-cipher)那样使用固定移位。<sup>[1](https://www.teach.cs.toronto.edu/~csc110y/fall/notes/08-cryptography/02-one-time-pad.html)</sup>

安全性论证的依据是：对于任意密文和任意等长明文，恰好存在一个密钥将二者相互映射。若密钥是均匀随机抽取且仅使用一次，则观察密文不会改变明文的概率分布，因此窃听者除消息长度外一无所获。<sup>[1](https://www.teach.cs.toronto.edu/~csc110y/fall/notes/08-cryptography/02-one-time-pad.html)</sup><sup> • </sup><sup>[18](https://courses.csail.mit.edu/6.857/2021/files/recitations/R02-notes.pdf)</sup> 这种保护即使面对计算能力无界的攻击者依然成立，这正是一次性密码本区别于所有依赖计算假设的实际密码之处。<sup>[2](https://securitybook.eecs.berkeley.edu/chapters/lec08.html)</sup>

## 完善保密性及其代价

克劳德·E·香农是当时供职于[贝尔实验室](https://www.edgepedia.org/zh/bell-labs)的数学家和密码学家，他基于一份1945年的机密报告（后解密），于1949年10月在《贝尔系统技术期刊》（第28卷，第656至715页）上发表论文，建立了保密系统理论。<sup>[8](https://onlinelibrary.wiley.com/doi/10.1002/j.1538-7305.1949.tb00928.x)</sup> 一次性密码本是他所定义的完善保密性的典范示例。<sup>[1](https://www.teach.cs.toronto.edu/~csc110y/fall/notes/08-cryptography/02-one-time-pad.html)</sup>

这一保证伴随三项代价，使该方案对大多数通信流量而言不切实际。密钥必须与消息等长，因此一吉字节的数据需要一吉字节的密钥；密钥不能重复使用；密钥必须通过与消息本身同等安全的信道送达接收方。若已存在用于交换 \( n \) 比特密钥的安全信道，原则上可以直接交换 \( n \) 比特的消息，不过密码本的优点在于密钥可以预先交换、日后使用。<sup>[2](https://securitybook.eecs.berkeley.edu/chapters/lec08.html)</sup> 外交官在整个20世纪都以这种方式使用该方案，交换大本大本的随机密钥材料，然后在远距离上安全通信。<sup>[2](https://securitybook.eecs.berkeley.edu/chapters/lec08.html)</sup>

一次性密码本也不提供完整性。由于翻转密文的一位会翻转明文的对应位，攻击者修改密文会在解密消息中产生可预测的变化，因此保密性和消息认证是分离的目标，需要各自的机制。<sup>[6](https://staff.ie.cuhk.edu.hk/~smchow/4150/)</sup>

## 密钥重用与两次密码本

密钥一旦被使用两次，安全性证明便立即失效。若两条密文用同一密钥 \( k \) 计算，则 \( c_1 \oplus c_2 = (k \oplus m_1) \oplus (k \oplus m_2) = m_1 \oplus m_2 \)：密钥相互抵消，攻击者手中握有两条明文的异或值，这往往会泄露敏感内容，且一条消息的已知比特会揭示另一条的对应比特。<sup>[2](https://securitybook.eecs.berkeley.edu/chapters/lec08.html)</sup>

VENONA计划是这一失败的历史明证。美国陆军信号情报局于1943年2月启动了一项秘密计划，后代号为VENONA，旨在利用苏联的外交通信，该计划一直运行到1980年。<sup>[9](https://www.nsa.gov/serve-from-netstorage/news-features/declassified-documents/venona/index.html)</sup> 1942年初的几个月里，克格勃的密码中心在超过35,000页的加数本上印制了密钥材料的重复副本，并装订成一次性密码本，于是出现了两套表面上各自唯一、实则相同的密码本。<sup>[10](https://www.cia.gov/resources/csi/static/Venona-Front-Matter-Introduction-chronology-abbreviations.pdf)</sup> 1943年秋，美国陆军中尉理查德·哈洛克在分析苏联“贸易”通信时发现了重复页面的证据，包括塞西尔·菲利普斯在内的同事做出了统计学观察，使密码分析人员得以剥离密码；直到1948年6月，某条线路上仍不断出现重复页面。<sup>[10](https://www.cia.gov/resources/csi/static/Venona-Front-Matter-Introduction-chronology-abbreviations.pdf)</sup><sup> • </sup><sup>[11](https://www.washingtonpost.com/archive/politics/1996/10/19/inside-the-unbreakable-code/d443ee28-e66e-4432-8046-865f8fdd21a7/)</sup> 广为人知的是，解密后的通信揭露了朱利叶斯（代号LIBERAL）和埃塞尔·罗森堡参与苏联间谍网的事实，约3,000份译文自1995年7月起陆续公开。<sup>[9](https://www.nsa.gov/serve-from-netstorage/news-features/declassified-documents/venona/index.html)</sup>

## 起源

吉尔伯特·弗纳姆供职于美国电话电报公司，于1917年发明了一种电传打字机密码，将打孔纸带上的消息与密钥纸带相结合进行加密；他在1917年的论文中已经指出，由“完全随机选取”的字母构成的密钥将产生“绝对不可破译”的密码。<sup>[4](https://www.nsa.gov/History/Cryptologic-History/Historical-Events/Historical-Events-List/)</sup><sup> • </sup><sup>[12](https://cipherhistory.com/onetimepad.html)</sup> 1919年，美国陆军上尉约瑟夫·O·莫博恩（后晋升少将并出任信号兵团司令）通过将循环重复的密钥纸带替换为仅使用一次的密钥，完善了一次性密码本系统，他与弗纳姆并列为一次性密码本的共同发明人。<sup>[5](https://www.nsa.gov/press-room/digital-media-center/biographies/biography-view-page/article/3903416/mg-joseph-o-mauborgne-usa/)</sup><sup> • </sup><sup>[12](https://cipherhistory.com/onetimepad.html)</sup> 两人之间的功劳归属在历史上存在争议。<sup>[13](https://www.altifina.com/en/research/mauborgne-1915/)</sup>

## 物理形态与谍报技艺

情报机构将一次性密码本作为实物发放。中央情报局博物馆描述了成对配套发放的密码本，一本供编码者使用，一本供解码者使用，没有两套、也没有两页是相同的；每页载有以五位数字组形式呈现的随机密钥，一页用毕即撕下销毁。<sup>[3](https://www.cia.gov/legacy/museum/artifact/one-time-pads/)</sup> 密码本由纸张、丝绸或极易燃的硝酸纤维素薄膜制成，后者可在紧急情况下迅速销毁，尺寸可小至一张邮票。<sup>[3](https://www.cia.gov/legacy/museum/artifact/one-time-pads/)</sup>

## 流密码与现代后继者

完善保密性的吸引力促使密码学家开发流密码——一种对称密钥系统，模拟一次性密码本但共享一个小得多的秘密密钥，利用算法从该密钥生成密钥流。流密码放弃了完善保密性，因为其密钥流并非真正随机，以此换取实用的密钥长度。<sup>[1](https://www.teach.cs.toronto.edu/~csc110y/fall/notes/08-cryptography/02-one-time-pad.html)</sup> 任何与一次性密码本同等安全的密码，其密钥必须满足实际上相同的要求，因此这一取舍不可避免。<sup>[14](https://www.classes.cs.uchicago.edu/archive/2021/winter/23200-1/07.pdf)</sup>

一次性密码本加密还与量子密钥分发（QKD）配合找到了用武之地，后者分发极长的随机密钥，其安全性基于物理原理而非计算假设。由于每比特数据消耗一比特密钥，实际的一次性密码本加密要求很高的密钥生成速率；美国国家标准与技术研究院的一个试验平台展示了足够快的量子密钥分发，可对实时视频进行一次性密码本加密。<sup>[15](https://www.nist.gov/publications/high-speed-quantum-key-distribution-system-supports-one-time-pad-encryption-real-time)</sup> 欧盟网络安全局将共享极长密钥用于一次性密码本加密确定为量子密钥分发的主要用例，因成本原因集中于极高保证级别的国家安全应用。<sup>[7](https://www.enisa.europa.eu/sites/default/files/publications/Briefing_Quantum_Key_Distribution.pdf)</sup> 各国政府的评估仍持谨慎态度：美国[国家安全局](https://www.edgepedia.org/zh/national-security-agency)不建议将量子密钥分发用于国家安全系统，英国国家网络安全中心建议以抗量子密码作为首选方案，并指出与AES相比，一次性密码本的高密钥消耗需要大得多的信道带宽。<sup>[16](https://www.nsa.gov/Cybersecurity/Quantum-Key-Distribution-QKD-and-Quantum-Cryptography-QC/trk/article-ssr-frontend-pulse_little-text-block/)</sup><sup> • </sup><sup>[17](https://www.gov.uk/government/publications/quantum-key-distribution-research-report/quantum-key-distribution-research-report)</sup>

## References

1. [The One-Time Pad and Perfect Secrecy, University of Toronto CSC110 course notes](https://www.teach.cs.toronto.edu/~csc110y/fall/notes/08-cryptography/02-one-time-pad.html)
2. [Introduction to Encryption, The Structure of Secure Systems, UC Berkeley](https://securitybook.eecs.berkeley.edu/chapters/lec08.html)
3. [One-Time Pads, CIA Museum](https://www.cia.gov/legacy/museum/artifact/one-time-pads/)
4. [Historical Events List, NSA Center for Cryptologic History](https://www.nsa.gov/History/Cryptologic-History/Historical-Events/Historical-Events-List/)
5. [MG Joseph O. Mauborgne, USA, NSA biography](https://www.nsa.gov/press-room/digital-media-center/biographies/biography-view-page/article/3903416/mg-joseph-o-mauborgne-usa/)
6. [IERG4150 Introduction to Cryptography, CUHK](https://staff.ie.cuhk.edu.hk/~smchow/4150/)
7. [Quantum Key Distribution: ENISA Briefing](https://www.enisa.europa.eu/sites/default/files/publications/Briefing_Quantum_Key_Distribution.pdf)
8. [Shannon, C.E. (1949). Communication Theory of Secrecy Systems. Bell System Technical Journal 28: 656-715](https://onlinelibrary.wiley.com/doi/10.1002/j.1538-7305.1949.tb00928.x)
9. [VENONA Documents, NSA](https://www.nsa.gov/serve-from-netstorage/news-features/declassified-documents/venona/index.html)
10. [What Made Venona Possible?, CIA Center for the Study of Intelligence](https://www.cia.gov/resources/csi/static/Venona-Front-Matter-Introduction-chronology-abbreviations.pdf)
11. [Inside the Unbreakable Code, The Washington Post (1996)](https://www.washingtonpost.com/archive/politics/1996/10/19/inside-the-unbreakable-code/d443ee28-e66e-4432-8046-865f8fdd21a7/)
12. [Cipher History: the one-time pad](https://cipherhistory.com/onetimepad.html)
13. [The Shadow of the One-Time Pad, Altifina research](https://www.altifina.com/en/research/mauborgne-1915/)
14. [Cryptography Part 1, University of Chicago course notes](https://www.classes.cs.uchicago.edu/archive/2021/winter/23200-1/07.pdf)
15. [High Speed Quantum Key Distribution System Supports One-Time Pad Encryption of Real-Time Video, NIST](https://www.nist.gov/publications/high-speed-quantum-key-distribution-system-supports-one-time-pad-encryption-real-time)
16. [Quantum Key Distribution (QKD) and Quantum Cryptography (QC), NSA](https://www.nsa.gov/Cybersecurity/Quantum-Key-Distribution-QKD-and-Quantum-Cryptography-QC/trk/article-ssr-frontend-pulse_little-text-block/)
17. [Quantum key distribution research report, DSIT/GOV.UK](https://www.gov.uk/government/publications/quantum-key-distribution-research-report/quantum-key-distribution-research-report)
18. [courses.csail.mit.edu](https://courses.csail.mit.edu/6.857/2021/files/recitations/R02-notes.pdf)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 网络与安全 › Security governance and internet policy › Cryptographic protocols › Key management

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/one-time-pad

English original: https://www.edgepedia.org/one-time-pad
