# 维吉尼亚密码

维吉尼亚密码（Vigenère cipher）是一种经典的多表替换密码，它通过一个循环使用的关键词中对应字母所决定的位移量，来对明文中的每个字母进行移位加密。由于位移量逐字母变化，同一个明文字母可能加密成不同的密文字母，这就使得破解单表替换密码（如凯撒密码）的简单字母频率分析失效了。<sup>[1](https://ieeexplore.ieee.org/abstract/document/11619755)</sup><sup> • </sup><sup>[2](https://cs.uri.edu/cryptography/classical-ciphers/vigenere/article.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 密码族 | 多表替换；每个关键词字母从26个凯撒位移字母表中选定一个<sup>[3](https://www.cs.trincoll.edu/cryptography/vigenere.html)</sup> |
| 归属 | 由乔万·巴蒂斯塔·贝拉索（Giovan Battista Bellaso）于1553年发明；布莱斯·德·维吉尼亚（Blaise de Vigenère）在1586年的《数字密码论》（*Traicté des chiffres*）中将其推广，书中注明发明者为“某位贝拉索”<sup>[4](https://www.cipherchronicle.com/en/compare/caesar-vs-vigenere)</sup><sup> • </sup><sup>[5](https://ep.liu.se/ecp/171/007/ecp2020_171_007.pdf)</sup> |
| 密钥空间 | 长度为m的关键词有26^m<sup>m</sup>种可能；7个字母的密钥约有80亿种组合<sup>[4](https://www.cipherchronicle.com/en/compare/caesar-vs-vigenere)</sup> |
| 历史声誉 | 约三百年间被认为实际上不可破解，被称为“不可破译的密码”<sup>[3](https://www.cs.trincoll.edu/cryptography/vigenere.html)</sup><sup> • </sup><sup>[4](https://www.cipherchronicle.com/en/compare/caesar-vs-vigenere)</sup> |
| 首次公开发表的破解 | 德国步兵军官弗里德里希·W·卡西斯基（Friedrich W. Kasiski）在《密写术与解密术》（*Die Geheimschriften und die Dechiffrir-Kunst*，柏林，米特勒出版社，1863年，95页）中发表了攻击方法<sup>[6](https://archive.cryptologicfoundation.org/community/cryptologic-history/museum-support/national-cryptologic-library.html/title/rare-german-cryptology-book-by-kasiski-posted-5-7-13-)</sup><sup> • </sup><sup>[7](https://books.google.com/books?id=I1PgeY9uJ08C)</sup> |
| 更早的未公开破解 | 查尔斯·巴贝奇（Charles Babbage）于1854年发现了该方法，但从未发表<sup>[4](https://www.cipherchronicle.com/en/compare/caesar-vs-vigenere)</sup> |
| 现代地位 | 已被卡西斯基检验和重合指数破解；不再用于真正的安全场景，后者依赖高级加密标准（AES）等算法<sup>[1](https://ieeexplore.ieee.org/abstract/document/11619755)</sup><sup> • </sup><sup>[8](https://csrc.nist.gov/pubs/fips/197/final)</sup> |

## 加密原理

发送方与接收方约定一个关键词，通常是一个容易记住的词或短语。每个关键词字母被转换为模26的一个数字，明文字母依次按这些数字移位；关键词用完后从头循环。以密钥“vector”为例，转换为位移量（21, 4, 2, 19, 14, 17），明文“here is how it works”加密为“citxwjcsybhnjvml”；解密时按相同数字反向移位。<sup>[9](https://mathcenter.oxford.emory.edu/site/math125/vigenereCipher/)</sup>

形式上，该密码以m个字母为一块进行处理，密钥本身也是m个字母的一块，可能的密钥数量随m指数增长，这使得中等长度的密钥无法靠手工暴力破解。<sup>[10](https://secgroup.dais.unive.it/teaching/cryptography/polyalphabetic-ciphers/)</sup> 周期性密钥的一个后果是：两个相同的明文字母只有在消息中的位置相差m的整数倍时才会加密成相同字母，否则加密结果不同。在一个以FLUTE为密钥的例子中，“THISISAVERYSECRETMESSAGE”中的两个字母“I”分别加密为“C”和“M”，而相隔15个位置（5的倍数）的两个“S”都加密为“X”。<sup>[10](https://secgroup.dais.unive.it/teaching/cryptography/polyalphabetic-ciphers/)</sup>

罗德岛大学的密码学课程描述了两种版本：上述关键词法，以及自动密钥法——密钥由引导字母和消息本身扩展而成。<sup>[2](https://cs.uri.edu/cryptography/classical-ciphers/vigenere/article.html)</sup>

## 为何能抵御频率分析

在凯撒密码中，出现最频繁的密文字母就是出现最频繁的明文字母的映射，因此几分钟内就能重建替换表。维吉尼亚密码则压平了这种分布：明文E可能根据落在其上的密钥字母不同，在密文中表现为I、J、V或其他字母。在一个实例中，七个明文T分别加密为H、L、K、M、G、X和L，掩盖了英语中T的频率特征。<sup>[3](https://www.cs.trincoll.edu/cryptography/vigenere.html)</sup><sup> • </sup><sup>[4](https://www.cipherchronicle.com/en/compare/caesar-vs-vigenere)</sup>

但这种伪装并不彻底。任何维吉尼亚密文都相当于若干个简单替换密码的集合，其数量等于关键词的字母数，而密码仍然保留了明文的大部分统计结构。<sup>[3](https://www.cs.trincoll.edu/cryptography/vigenere.html)</sup><sup> • </sup><sup>[10](https://secgroup.dais.unive.it/teaching/cryptography/polyalphabetic-ciphers/)</sup>

## 破解密码

两种经典攻击都分两步进行：先恢复关键词长度m，再恢复关键词本身。<sup>[10](https://secgroup.dais.unive.it/teaching/cryptography/polyalphabetic-ciphers/)</sup>

**卡西斯基检验。** 当相同的明文序列恰好与循环密钥的相同部分对齐时，就会产生相同的密文序列。卡西斯基的技术测量这些重复组之间的距离并对其做因数分解；出现最频繁的因数就是关键词长度的最佳候选。在经典例子中，以RELATIONS为密钥加密“TOBEORNOTTOBETHATISTHEQUESTION”，重复的双字母组KS出现在相隔9的位置上，提示关键词长度为9（3也是候选，因为3能整除9）。<sup>[3](https://www.cs.trincoll.edu/cryptography/vigenere.html)</sup> 罗德岛大学的一个以POETRY为密钥的例子显示，重复的密文组IVE分别相隔12个和6个字母，都是6的倍数。<sup>[11](https://cs.uri.edu/cryptography/classical-ciphers/vigenere/cryptanalysis-article.html)</sup>

一旦知道m，密文就被分成m个陪集，每个陪集由一个关键词字母加密，只要样本足够长，每个陪集都可以用频率分析作为独立的凯撒密码或简单替换密码来破解。<sup>[11](https://cs.uri.edu/cryptography/classical-ciphers/vigenere/cryptanalysis-article.html)</sup> 一种归功于法国密码学家克尔克霍夫（Kerckhoff）的变体直接重建关键词：在每一列中，假设出现最频繁的字母对应明文E，再通过逻辑分析补全密钥。<sup>[3](https://www.cs.trincoll.edu/cryptography/vigenere.html)</sup>

**重合指数。** 弗里德曼检验使用重合率，即文本中随机选取两个字母恰好相同的概率。普通英语的重合率约为0.065；接近该值的文本很可能是单表密码，而介于约0.0385和0.065之间的值则表明是多表密码。分析者对密文的各种候选拆分计算这一统计量，选择各陪集数值接近该语言特征值的关键词长度。<sup>[11](https://cs.uri.edu/cryptography/classical-ciphers/vigenere/cryptanalysis-article.html)</sup> 该指数在字母均匀分布时取最小值1/26 ≈ 0.038，在文本全为同一重复字母时取最大值1，因此它衡量的是字母分布的不均匀程度。<sup>[10](https://secgroup.dais.unive.it/teaching/cryptography/polyalphabetic-ciphers/)</sup>

**实际限制。** 直接对原始密文做频率分析会彻底失败，因为多表密钥将字母分布平均到了m种不同的位移上；必须先做分列。单个重复三字母组不足以可靠地证明密钥长度，因为较短或运气不佳的密文会产生偶然重复，所以分析者会寻找多个重复距离的共同因数，或用重合指数交叉验证。这两种统计方法都需要大量数据，在远低于约100个字符的密文上并不可靠，而当密钥与消息等长时两者都不适用。<sup>[12](https://sinapsi.wiki/w/ctf-crypto/p/classical/vigenere-cipher/)</sup> 实验评估证实，关键词较短、密文较长时，最容易恢复密钥。<sup>[1](https://ieeexplore.ieee.org/abstract/document/11619755)</sup>

## 历史

该密码的发明者曾被张冠李戴。乔万·巴蒂斯塔·贝拉索于1553年发表了这一方案；布莱斯·德·维吉尼亚在1586年的《数字密码论》中提出了基于它的表格，并诚实地指出发明者是“某位贝拉索”，但维吉尼亚的名字却与这个密码绑在了一起。<sup>[4](https://www.cipherchronicle.com/en/compare/caesar-vs-vigenere)</sup><sup> • </sup><sup>[5](https://ep.liu.se/ecp/171/007/ecp2020_171_007.pdf)</sup> 维吉尼亚的表格只使用了原始的20个拉丁字母，不包括希腊字母Y和Z。<sup>[5](https://ep.liu.se/ecp/171/007/ecp2020_171_007.pdf)</sup>

约三个世纪里，类维吉尼亚密码被认为实际上不可破解。该密码的覆灭分两步展开：1854年查尔斯·巴贝奇的一次从未发表的破解，随后是卡西斯基1863年的著作——作者弗里德里希·威廉·卡西斯基是德国步兵军官兼密码学家——该书被认为是关于破解多表替换密码（尤其是维吉尼亚密码）方法的最早印刷描述。<sup>[4](https://www.cipherchronicle.com/en/compare/caesar-vs-vigenere)</sup><sup> • </sup><sup>[6](https://archive.cryptologicfoundation.org/community/cryptologic-history/museum-support/national-cryptologic-library.html/title/rare-german-cryptology-book-by-kasiski-posted-5-7-13-)</sup> 卡西斯基的《密写术与解密术》泛论密写，包括四方密码和隐形墨水，以及德语和法语文本的解密方法。<sup>[7](https://books.google.com/books?id=I1PgeY9uJ08C)</sup>

一个变体——格龙斯菲尔德密码（Gronsfeld cipher）——确实在德国流行起来，并在中欧广泛使用。它用密钥数字的各位数字代替关键词字母，因而更弱，因为只有10个替换字母表可用，而非26个。<sup>[3](https://www.cs.trincoll.edu/cryptography/vigenere.html)</sup>

## 今日地位

维吉尼亚密码在保密性上已经过时。其弱点在于短小且循环的密钥，攻击者可以据此恢复密钥长度，将问题化为若干独立的频率分析。<sup>[13](https://arxiv.org/abs/1912.04519)</sup> 现代指南将经典密码视为教学工具；真正的安全使用标准化算法，如高级加密标准（AES），其在FIPS 197中规定为128位分组，密钥长度为128、192或256位。<sup>[8](https://csrc.nist.gov/pubs/fips/197/final)</sup> 该密码在教学上仍有稳固地位，因为它同时引出了多表替换的思想以及击败它的统计方法——卡西斯基检验和重合指数。<sup>[1](https://ieeexplore.ieee.org/abstract/document/11619755)</sup>

## References

1. [Cryptoanalysis of Vigenère Cipher using Kasiski Examination and Frequency Analysis Techniques, IEEE (ICCBI 2026)](https://ieeexplore.ieee.org/abstract/document/11619755)
2. [Vigenère Cipher Description, University of Rhode Island Cryptography course](https://cs.uri.edu/cryptography/classical-ciphers/vigenere/article.html)
3. [Cryptography: Vigenere Cipher, Trinity College](https://www.cs.trincoll.edu/cryptography/vigenere.html)
4. [Caesar vs Vigenère — which cipher fits which job?, CipherChronicle](https://www.cipherchronicle.com/en/compare/caesar-vs-vigenere)
5. [Structured Analysis and Comparison of Alphabets in Historical Handwritten Ciphers, HistoCrypt 2020 proceedings](https://ep.liu.se/ecp/171/007/ecp2020_171_007.pdf)
6. [Rare German cryptology book by Kasiski, National Cryptologic Foundation](https://archive.cryptologicfoundation.org/community/cryptologic-history/museum-support/national-cryptologic-library.html/title/rare-german-cryptology-book-by-kasiski-posted-5-7-13-)
7. [F. W. Kasiski, Die Geheimschriften und die Dechiffrir-Kunst (Mittler, 1863), Google Books](https://books.google.com/books?id=I1PgeY9uJ08C)
8. [FIPS 197, Advanced Encryption Standard (AES), NIST CSRC](https://csrc.nist.gov/pubs/fips/197/final)
9. [The Vigenere Cipher, Emory University Math Center](https://mathcenter.oxford.emory.edu/site/math125/vigenereCipher/)
10. [Polyalphabetic ciphers, Secgroup @ Ca' Foscari](https://secgroup.dais.unive.it/teaching/cryptography/polyalphabetic-ciphers/)
11. [Vigenere Cipher Cryptanalysis, University of Rhode Island](https://cs.uri.edu/cryptography/classical-ciphers/vigenere/cryptanalysis-article.html)
12. [Vigenere Cipher — Kasiski & index-of-coincidence key length, Sinapsi wiki](https://sinapsi.wiki/w/ctf-crypto/p/classical/vigenere-cipher/)
13. [Analyzing the Kasiski Method Against Vigenere Cipher, arXiv](https://arxiv.org/abs/1912.04519)

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

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › General discrete mathematics and discrete structures › Discrete mathematics

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/vigenere-cipher

English original: https://www.edgepedia.org/vigenere-cipher
