Quagmire 密码解码器和编码器

Quagmire 密码是一组使用基于关键字替换字母表的四种周期性多字母密码。由美国密码协会开发,每种变体(I 至 IV)应用不同的关键字混合和标准字母表组合及指示密钥。使用此免费工具即时用任意 Quagmire 类型编码和解码消息。

结果
0 字符
Variant:Quagmire IQuagmire IIQuagmire IIIQuagmire IVKeyed plaintext, standard cipher
Keyword:
Indicator:
Options:Preserve Case

Quagmire I Cipher Configuration

Plaintext Alphabet

C
I
P
H
E
R
A
B
D
F
G
J
K
L
M
N
O
Q
S
T
U
V
W
X
Y
Z

Ciphertext Alphabet

A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z

Indicator Key: KEY

Period length: 3
Quagmire I: Keyed plaintext, standard cipher
Uses keyword-generated plaintext alphabet with standard cipher alphabet

Frequently Asked Questions About Quagmire Cipher

What is the Quagmire cipher?

It is a family of four periodic polyalphabetic substitution ciphers developed by the American Cryptogram Association. Each variant uses keyword-mixed alphabets and an indicator key to generate multiple cipher alphabets. The four types differ in which alphabets (plaintext, ciphertext, or both) are keyword-mixed, providing progressively stronger encryption.

What are the four Quagmire cipher types?

Quagmire I uses a keyword-mixed plaintext alphabet with a standard ciphertext alphabet. Quagmire II uses a standard plaintext alphabet with a keyword-mixed ciphertext alphabet. Quagmire III uses the same keyword-mixed alphabet for both plaintext and ciphertext. Quagmire IV uses two different keyword-mixed alphabets for plaintext and ciphertext, making it the most complex variant.

How does Quagmire I differ from Quagmire IV?

Quagmire I is the simplest variant, requiring only one keyword to mix the plaintext alphabet while using a standard ciphertext alphabet. Quagmire IV is the most complex, requiring two separate keywords to independently mix both the plaintext and ciphertext alphabets. This gives Quagmire IV a much larger keyspace and makes it significantly harder to break through cryptanalysis.

How do you encrypt with the Quagmire cipher?

First select a variant type (I-IV) and enter the required keywords and indicator key. For each plaintext letter, find its position in the plaintext alphabet, then look up the corresponding letter in the ciphertext alphabet that has been shifted according to the current indicator key letter. The indicator key repeats across the message, cycling through different alphabet shifts.

How is Quagmire related to the Vigenere cipher?

The Quagmire cipher extends the Vigenere concept. Quagmire II with a standard alphabet and no keyword mixing is essentially equivalent to the Vigenere cipher. The Quagmire family adds keyword-mixed alphabets on top of the periodic polyalphabetic substitution that Vigenere introduced, creating more complex and harder-to-break encryption while keeping the same periodic key structure.

How do you break a Quagmire cipher?

Start by determining the key period using Kasiski examination or index of coincidence analysis. Once the period is known, separate the ciphertext into groups encrypted by each key letter and apply frequency analysis to each group. For keyword-mixed variants, pattern analysis and word-guessing techniques help recover the mixed alphabet. Quagmire IV is hardest to break because both alphabets must be recovered independently.

Which Quagmire type is the most secure?

Quagmire IV is the most secure variant. It uses two independent keyword-mixed alphabets for plaintext and ciphertext, creating the largest keyspace and the most irregular substitution patterns. Each additional keyword multiplies the complexity an attacker must overcome. However, all Quagmire types remain vulnerable to modern computational cryptanalysis when sufficient ciphertext is available.

什么是泥沼密码?

泥沼密码(Quagmire cipher)是一个由四种周期性多表替换密码组成的密码族,通过关键词混合字母表维吉尼亚密码进行了扩展。该系统以密码分析者在尝试破解时所面临的困难而命名,由美国密码协会(ACA)将其划分为 I 型至 IV 型。

与仅对标准字母表进行移位的维吉尼亚密码不同,泥沼密码族使用带有关键词的字母表,彻底打乱了字母频率关系。这使得密文对频率分析和其他经典密码分析技术的抵抗力大幅提高。

四种泥沼密码变体

泥沼 I 型

使用关键词混合明文字母表搭配直接(标准)密文字母表。这是最简单的变体,也是了解关键词字母表密码的绝佳入门方式。需要两个关键词:一个用于明文字母表,另一个作为指示词。

泥沼 II 型

与 I 型配置相反:使用直接明文字母表关键词混合密文字母表。与 I 型安全性相当,但针对密码分析的攻击面不同。同样需要两个关键词。

泥沼 III 型(带关键词的维吉尼亚密码)

最流行的变体,也称为带关键词的维吉尼亚密码(Keyed Vigenere cipher)。对明文和密文位置均使用相同的关键词字母表。在安全性与易用性之间取得了最佳平衡,这也解释了它在 ACA 竞赛和地理藏宝谜题中广受欢迎的原因。

泥沼 IV 型

安全性最高的变体,使用两种不同的关键词字母表——一种用于明文,另一种用于密文。共需要三个关键词,创造了最大的密钥空间。在没有良好已知明文的情况下极难破解。

对比表

特征I 型II 型III 型IV 型
明文字母表关键词混合直接关键词混合(相同)关键词混合
密文字母表直接关键词混合关键词混合(相同)关键词混合(不同)
所需关键词数2223
安全级别良好良好较好最佳
适用场景学习入门变体练习通用最高安全性

工作原理

创建关键词字母表

取关键词并去除重复字母,然后按顺序附加剩余字母。例如,关键词 CIPHER 生成:CIPHERABDFGJKLMNOQSTUVWXYZ

构建密码表

指示词决定了使用多少个密码字母表及其旋转方式。指示词中的每个字母对应关键词字母表的特定移位量。指示位置参数(通常为 A)控制对齐方式。

加密示例(I 型)

设置: 明文关键词:CIPHER,指示词:KEY,位置:A

明文:   C I P H E R A B D F G J K L M N O Q S T U V W X Y Z
[K] C0:  K L M N O P Q R S T U V W X Y Z A B C D E F G H I J
[E] C1:  E F G H I J K L M N O P Q R S T U V W X Y Z A B C D
[Y] C2:  Y Z A B C D E F G H I J K L M N O P Q R S T U V W X

加密 HELLO:H→S,E→I,L→V,L→Y,O→S = SIVYS

泥沼密码 vs 维吉尼亚密码

两者的根本区别在于字母表的构造方式。维吉尼亚密码仅使用移位后的标准字母表,保留了相对频率关系。泥沼密码通过关键词字母表打乱了这些关系,使频率分析更加困难。

不使用关键词混合、采用标准字母表的泥沼 II 型本质上等同于维吉尼亚密码。每种后续类型都在周期性多表替换框架的基础上增加了复杂度。

密码分析与安全性

所有泥沼密码变体都可以在有足够密文和正确方法的情况下被破解:

  1. 周期检测 — 使用 Kasiski 检测法或重合指数确定指示词长度
  2. 已知明文分析 — 已知或疑似明文片段可帮助恢复密钥
  3. 频率分析 — 确定周期后,对每组分别进行独立分析
  4. 暴力破解 — 对较短的指示词(3-5 个字母)可行

IV 型最难破解,因为两个字母表必须分别独立恢复。

功能特性

  • 支持全部四种变体,集成于同一工具
  • 实时加密和解密,即时响应输入
  • 字母表可视化展示,便于理解替换过程
  • 智能关键词验证,自动去除重复字母
  • 复制与下载结果,支持标准五字母分组格式
  • 移动端响应式设计

相关工具