工具 指南
安全 免费 无需注册

维吉尼亚密码

使用维吉尼亚密码加密和解密文本,并探索经典密码学。

正在加载工具…

关于此工具

完整的经典密码工具包,包含带交互式密码表的维吉尼亚密码、凯撒密码(位移1–25)、ROT13和Atbash。维吉尼亚模式可视化26×26方格,高亮显示活跃的密钥字母,并提供逐步编码表。内置"破解"频率分析工具,可提示破解未知维吉尼亚密钥的方法。

使用方法

  1. 1 第一步:选择密码模式标签:维吉尼亚、凯撒、ROT13或Atbash。
  2. 2 第二步:输入明文(或密文),对于维吉尼亚/凯撒密码,请提供关键词或位移值。
  3. 3 第三步:点击加密或解密。结果将立即显示,并附有逐步字符表。
  4. 4 第四步:对于维吉尼亚密码,使用"破解"标签运行频率分析,将字母分布与预期的英文频率进行比较。

The idea that makes Vigenère stronger than Caesar

A Caesar cipher shifts every letter by the same fixed amount, so the letter E always becomes the same ciphertext letter. That single, constant shift is its fatal weakness: count the letters and the most common one is almost certainly E in disguise. The Vigenère cipher defeats this by using a repeating keyword so that each position is shifted by a different amount. It is a polyalphabetic cipher — it uses many shift alphabets instead of one — which is why the same plaintext letter can encrypt to several different ciphertext letters depending on where it sits.

How the keyword drives the shifts

Write your keyword repeatedly above the message, one key letter per plaintext letter. Each key letter selects a shift: A shifts by 0, B by 1, C by 2, and so on up to Z by 25. To encrypt, add the key letter's shift to the plaintext letter (wrapping around past Z back to A). To decrypt, subtract it. Crucially, the key index advances only on alphabetic characters — spaces, digits, and punctuation pass through untouched and do not consume a key letter, and letter case is preserved. This tool visualizes the whole process with the classic 26×26 tableau (the Vigenère square), highlighting the columns that belong to your key, and prints a step-by-step table of the first 40 letters showing plaintext, key letter, shift, and result.

A worked example

Encrypt HELLO with the keyword KEY. The repeating key is K E Y K E, giving shifts 10, 4, 24, 10, 4:

  • H (7) + 10 = 17 → R
  • E (4) + 4 = 8 → I
  • L (11) + 24 = 35 mod 26 = 9 → J
  • L (11) + 10 = 21 → V
  • O (14) + 4 = 18 → S

So HELLO becomes RIJVS. Notice the two Ls encrypted to different letters (J and V) because they fell under different key letters — exactly the property that hides the frequency fingerprint a Caesar cipher leaves behind.

The three companion ciphers

  • Caesar: a single fixed shift from 1 to 25. Simple, and its own family of 25 possible keys makes it trivially breakable by trying them all.
  • ROT13: a Caesar cipher locked to a shift of 13. Because 13 is exactly half of 26, applying it twice returns the original — it is its own inverse, which is why it is used to lightly hide spoilers, not to secure anything.
  • Atbash: mirrors the alphabet so A↔Z, B↔Y, and so on. It needs no key and is also self-inverse.

How the "Crack It" analysis works

For centuries Vigenère was called le chiffre indéchiffrable ("the undecipherable cipher") until cryptanalysts learned to attack the key length. The Crack It tab gives you the two classic tools. First, a letter-frequency chart overlays your ciphertext's observed letter distribution against expected English frequencies; when a guessed key length is correct, slicing the text into columns makes each column's distribution start to resemble English. Second, it computes the Index of Coincidence (IC) — the probability that two randomly chosen letters match. English text has an IC near 0.065; uniformly random text sits near 0.038. A high IC points to a monoalphabetic cipher (Caesar or a very short key); a low IC signals a longer polyalphabetic key. The tool reports the value and a plain-language hint to steer your next guess.

Practical tips and honest limits

  • Longer, word-free keys are stronger. A key as long as the message, never reused, is the unbreakable one-time pad. A short dictionary word is the easiest to crack.
  • Mind what survives. Spaces and punctuation are preserved and can leak word lengths. For tougher puzzles, strip spaces and group the output into fixed blocks of five.
  • It is a learning toy, not security. Vigenère has been breakable since the 19th century. Use it for puzzles, escape rooms, classroom demonstrations, and CTF challenges — never to protect real secrets, for which you should use modern encryption.

常见问题

{# Alpine.js — self-hosted. (The previous jsdelivr CDN tag had a stale SRI integrity hash, so the browser refused to run it and window.Alpine was never defined — silently breaking every FAQ accordion and Alpine tool.) #}