🔐 维吉尼亚密码:在线加密与解密
专业的复式代换密码工具。一种使用基于关键词的一系列交错凯撒密码来加密字母文本的方法。尽管“不可破译的密码”易于理解和实现,但在三个世纪里它抵制了所有破解的尝试。
⚙️ 密码设置
🎯 加密过程可视化工具
分步可视化维吉尼亚密码如何加密您的消息
显示前50个字符...
📊 维吉尼亚方表 (Tabula Recta)
交互式复式代换表 - 维吉尼亚密码加密的基础
什么是维吉尼亚密码?完整指南
理解维吉尼亚密码加密
维吉尼亚密码是一种基于关键词字母使用一系列交错的凯撒密码来加密字母文本的方法。它由乔万·巴蒂斯塔·贝拉索于1553年发明,但以布莱斯·德·维吉尼亚的名字命名,后者于1586年对其进行了描述。在三个多世纪里,它被称为“le chiffre indéchiffrable”(不可破译的密码),因为它抵制了所有密码分析的尝试。 is a method of encrypting alphabetic text using a series of interwoven Caesar ciphers based on the letters of a keyword. It was invented by Giovan Battista Bellaso in 1553, but is named after Blaise de Vigenère, who described it in 1586. For over three centuries, it was known as "le chiffre indéchiffrable" (the indecipherable cipher) because it resisted all attempts at cryptanalysis.
维吉尼亚密码如何工作?
加密过程使用一个在整个明文中重复的关键词。关键词的每个字母决定了相应明文字母的移位: that is repeated throughout the plaintext. Each letter of the keyword determines the shift for the corresponding plaintext letter:
- 选择一个关键词:例如,“KEY” For example, "KEY"
- 将关键词与明文对齐:重复关键词以匹配您的消息长度 Repeat the keyword to match the length of your message
- 计算移位:将每个关键词字母转换为数字(A=0, B=1, ... Z=25) Convert each keyword letter to a number (A=0, B=1, ... Z=25)
- 应用凯撒密码:将每个明文字母按相应关键词字母的值进行移位 Shift each plaintext letter by the corresponding keyword letter value
- 循环:使用模26运算从Z回到A Use modulo 26 to wrap from Z back to A
维吉尼亚密码公式
维吉尼亚加密和解密的数学公式:
其中P = 明文字母位置,C = 密文字母位置,K = 密钥字母位置
维吉尼亚密码变体
标准维吉尼亚
使用加法的传统方法
博福特密码
使用减法:C = (K - P) mod 26
变异博福特
倒数版本:C = (P - K) mod 26
自动密钥密码
使用消息本身作为密钥的一部分以增强安全性
特里特米乌斯密码
递进密钥,每个位置使用不同的移位
如何使用维吉尼亚密码加密
- 在输入字段中输入您的明文消息
- 选择一个强密钥(越长越好)
- 选择您偏好的密码变体
- 配置大小写和字符处理选项
- 点击“加密”来加密您的消息
- 复制或下载密文结果
如何解密维吉尼亚密码
- 将密文粘贴到输入字段
- 输入用于加密的正确关键词
- 选择与加密时相同的密码变体
- 点击“解密”来解密消息
- 在输出字段中查看原始明文
破解维吉尼亚密码
虽然比简单替换密码强大得多,但维吉尼亚密码可以使用以下方法破解:
- 卡西斯基测试:寻找重复序列以确定密钥长度 Finding repeated sequences to determine key length
- 弗里德曼测试:使用统计分析来估计密钥长度 Statistical analysis to estimate key length
- 重合指数:测量频率分布以找到密钥长度 Measuring frequency distribution to find key length
- 频率分析:一旦知道密钥长度,就将其视为多个凯撒密码进行处理 Once key length is known, treating as multiple Caesar ciphers
维吉尼亚密码的安全性
安全强度取决于:
- 密钥长度:更长的密钥安全性呈指数级增长 Longer keys are exponentially more secure
- 密钥随机性:真正随机的密钥更难预测 Truly random keys are harder to predict
- 消息长度:较短的消息更难进行密码分析 Shorter messages are harder to cryptanalyze
- 密钥重用:切勿为多条消息重用相同的密钥 Never reuse the same key for multiple messages
注意:尽管具有历史意义,维吉尼亚密码在现代不安全,不适用于保护敏感信息。对于真正的安全需求,请使用AES或其他现代加密标准。 While historically significant, Vigenère cipher is not secure for protecting sensitive information in modern times. Use AES or other modern encryption standards for real security needs.
现代应用
如今,维吉尼亚密码用于:
- 教育目的和学习密码学基础知识
- 谜题和游戏创作(密室逃脱、ARG)
- 历史文献分析和研究
- 理解复式代换原理
- 教授编程和算法实现
- 不需要强安全性的简单混淆
🏛️ 历史意义
维吉尼亚密码由乔万·巴蒂斯塔·贝拉索于1553年发明,并在300年内未被破解。它赢得了“le chiffre indéchiffrable”(不可破译的密码)的绰号,并被广泛用于外交和军事通信,直到19世纪中叶查尔斯·巴贝奇和弗里德里希·卡西斯基独立开发出破解它的方法。
⚙️ 工作原理
维吉尼亚密码使用一个重复的关键词来创建多个凯撒密码移位。关键词的每个字母决定了相应明文字母的移位。例如,使用密钥“KEY”(K=10, E=4, Y=24),第一个字母移位10,第二个移位4,第三个移位24,然后模式重复。
🧮 数学基础
加密: Ci = (Pi + Ki) mod 26
解密: Pi = (Ci - Ki + 26) mod 26
其中 P = 明文字母位置 (A=0...Z=25),C = 密文字母位置,K = 密钥字母位置,mod = 模运算 Ci = (Pi + Ki) mod 26
Decryption: Pi = (Ci - Ki + 26) mod 26
Where P = plaintext letter position (A=0...Z=25), C = ciphertext letter position, K = key letter position, mod = modulo operation
🔐 安全性分析
优点:抵抗简单频率分析,多个凯撒移位增加了复杂性,更长的密钥提供更好的安全性。
缺点:易受卡西斯基测试攻击,有足够密文即可破解,密钥重复会产生模式,不适用于现代敏感数据。 Resistant to simple frequency analysis, multiple Caesar shifts increase complexity, longer keys provide better security.
Weaknesses: Vulnerable to Kasiski examination, can be broken with sufficient ciphertext, key repetition creates patterns, not suitable for modern sensitive data.
🎯 密码变体解释
标准维吉尼亚: C = (P + K) mod 26 - 基于加法的传统加密
博福特密码: C = (K - P) mod 26 - 基于减法的变体,自反
自动密钥密码:在初始关键词后使用明文作为密钥的一部分,消除密钥重复
特里特米乌斯密码:具有递增移位(0, 1, 2, 3...)的递进密钥 C = (P + K) mod 26 - Traditional addition-based encryption
Beaufort Cipher: C = (K - P) mod 26 - Subtraction-based variant, self-reciprocal
Autokey Cipher: Uses plaintext as part of the key after initial keyword, eliminating key repetition
Trithemius Cipher: Progressive key with incrementing shifts (0, 1, 2, 3...)
📚 实用技巧
为获得最佳效果:使用至少为消息长度1/3的密钥,避免使用字典词作为密钥,随机密钥提供最大安全性,切勿为不同消息重用密钥。为实现绝对安全,请使用一次性密码布(密钥长度=消息长度)。
常见错误:使用短或可预测的密钥,多次重用同一密钥,使用姓名或日期作为密钥。 Use keys at least 1/3 the message length, avoid dictionary words as keys, random keys provide maximum security, never reuse keys for different messages. For absolute security, use one-time pad (key length = message length).
Common Mistakes: Using short or predictable keys, reusing the same key multiple times, using names or dates as keys.