什麼是 維吉尼亞密碼?

免費線上維吉尼亞密碼工具。使用維吉尼亞密碼表加密或解密文字。

維吉尼亞密碼比凱薩這類簡單的替代密碼有了顯著進步。它不是將每個字母位移相同數量,而是使用關鍵字為每個字母決定不同的位移。這使它成為多字母替代密碼——相同的明文字母根據其位置可加密成不同的密文字母,能破解簡單的頻率分析。

加密方式是將關鍵字在明文下重複對齊。每個關鍵字字母決定對應明文字母的凱薩位移(A=0、B=1、...、Z=25)。關鍵字長度為 n 時,有效金鑰空間是 26^n。5 個字母的關鍵字會產生 26^5,約 1,200 萬種可能的金鑰,使暴力破解不切實際。

工具提供使用關鍵字的加密與解密、自動金鑰模式、逐字元金鑰視覺化與重合指數(IC)統計分析。自動金鑰模式使用明文本身延伸關鍵字,消除讓標準維吉尼亞密碼易受 Kasiski 檢驗攻擊的重複模式。金鑰視覺化精確顯示每個關鍵字字母如何對應到每個明文位置。

重合指數面板提供密文的統計洞察。英文明文的 IC 約為 0.0667。隨機文字的 IC 約為 0.0385。如果維吉尼亞加密文字顯示 IC 接近 0.0385,表示密碼運作正確。高於 0.045 的值則暗示關鍵字可能短到足以破解。

維吉尼亞密碼的實際應用案例

用關鍵字加密訊息

一位學生用關鍵字「SECRET」加密「ATTACK AT DAWN」。明文中的每個「A」都依其對齊的關鍵字字母加密成不同的字母。金鑰視覺化顯示逐字元的對應。IC 值確認了多字母替代的行為。用相同關鍵字解密即可恢復原始訊息。

使用自動金鑰模式獲得更強的加密

一位密碼學愛好者準備訊息並啟用自動金鑰模式。在關鍵字「KEY」用完之後,明文會接手延伸剩餘位置的金鑰。金鑰視覺化顯示先出現關鍵字字母,接著由明文字母接手。產生的密文不會顯示重複模式。

用重合指數分析密文

一位 CTF 玩家收到一段密文並用它跑工具。IC 計算顯示 0.042,與維吉尼亞加密一致。他們分析密文中的重複序列,嘗試不同的關鍵字長度。IC 有助於確認解密是否成功。

為什麼要使用 維吉尼亞密碼?

  • Keyword-based polyalphabetic encryption and decryption
  • Autokey mode for stronger encryption
  • Character-by-character key visualization
  • Index of Coincidence (IC) statistical analysis
  • Random secure key generator using crypto.getRandomValues
  • Key space up to 26^n for an n-letter keyword

如何使用 維吉尼亞密碼 — 逐步教學

1

Enter your keyword (letters only, case-insensitive).

2

Type your plaintext or ciphertext.

3

Choose Encrypt or Decrypt mode.

4

Toggle Autokey mode to use plaintext as key extension.

5

Enable Key Visualization to see per-character key mapping.

6

Check the IC value to analyze the output statistically.

維吉尼亞密碼適合誰?

  • 學習密碼學的學生
  • CTF 玩家
  • 謎題解謎者
  • 密碼學愛好者

維吉尼亞密碼專業技巧

  • 1使用自動金鑰模式獲得更強的加密。標準維吉尼亞密碼會重複關鍵字模式,使其易受 Kasiski 檢驗攻擊。自動金鑰使用明文延伸金鑰,消除了這種重複。
  • 2重合指數是強大的密碼分析工具。計算您密文的 IC——如果接近 0.0385,表示多字母加密有效地隱藏了字母頻率。如果高於 0.045,關鍵字可能太短。
  • 3隨機金鑰產生器使用 crypto.getRandomValues 產生密碼學上安全的隨機關鍵字。用它產生與訊息等長的金鑰,即可獲得接近一次性密碼本的加密強度。
  • 4切勿在多則訊息上重複使用同一個維吉尼亞關鍵字。用相同關鍵字加密的兩則訊息可結合抵消加密,透過 crib dragging 技術同時揭露兩份明文。

維吉尼亞密碼 — 常見問題

Vigenère 相較於 Caesar 的優勢是什麼?

Vigenère uses a keyword to apply different shifts to each letter, making it a polyalphabetic cipher. This resists simple frequency analysis because the same plaintext letter can encrypt to different ciphertext letters depending on position.

什麼是自動金鑰模式?

Autokey mode uses the plaintext itself to extend the keyword. After the keyword is exhausted, the plaintext characters are used as the key for subsequent positions. This prevents the repeating pattern that makes standard Vigenère vulnerable to Kasiski examination.

如何解讀重合指數?

IC measures how likely two randomly selected letters are identical. For English text, IC ≈ 0.0667. For random text, IC ≈ 0.0385. A Vigenère-encrypted text with a short keyword will have IC closer to 0.0385, while a value above 0.045 suggests the text may be monoalphabetic or the keyword is very long.

Does the text analyzer support non-English languages?

Yes. The analysis uses the browser's native Intl API for language-aware text segmentation. Word and character counting works correctly for most languages including Chinese, Japanese, Arabic, and accented Latin scripts.

Can I process very long documents?

Documents up to approximately 100,000 words are supported. Analysis is incremental, meaning results update instantly even for large texts without blocking the browser.

準備好使用 維吉尼亞密碼 了嗎?

免費線上工具 — 在瀏覽器中運作,無需註冊。立即開始使用。

立即試用
Free Forever · No Sign-up

182 Free Tools at Your Fingertips

All free online tools for developers, designers, students, and creators. Every tool works in your browser — no sign-up, no data collection.