[Paper Review] Unsupervised Cipher Cracking Using Discrete GANs
This paper proposes CipherGAN, a discrete GAN-based framework inspired by CycleGAN that unsupervisedly learns to map unpaired ciphertext and plaintext sequences to crack shift and Vigenère ciphers. By operating in an embedding space with Jacobian norm regularization, it achieves near-perfect accuracy (up to 99.8%) on character-level ciphers and 75.7% on word-level Vigenère ciphers with large vocabularies, while avoiding uninformative discrimination through continuous relaxation of discrete variables.
This work details CipherGAN, an architecture inspired by CycleGAN used for inferring the underlying cipher mapping given banks of unpaired ciphertext and plaintext. We demonstrate that CipherGAN is capable of cracking language data enciphered using shift and Vigenere ciphers to a high degree of fidelity and for vocabularies much larger than previously achieved. We present how CycleGAN can be made compatible with discrete data and train in a stable way. We then prove that the technique used in CipherGAN avoids the common problem of uninformative discrimination associated with GANs applied to discrete data.
Motivation & Objective
- To develop a fully unsupervised neural network framework that infers cipher mappings from unpaired plaintext and ciphertext without human-provided linguistic knowledge.
- To stabilize training of CycleGAN for discrete sequential data, which is typically unstable and sensitive to weight initialization.
- To resolve the uninformative discrimination problem—common in GANs applied to discrete data—by introducing a continuous relaxation via embedding space operations.
- To demonstrate that the model generalizes across diverse cipher types and vocabulary sizes, including large vocabularies (e.g., 200 words) and character-level ciphers with punctuation.
- To establish a foundation for unsupervised text-to-text translation by treating cipher cracking as a zero-shot language translation problem.
Proposed method
- Adapts the CycleGAN architecture to discrete sequential data by training a generator to learn a bijective mapping between plaintext and ciphertext distributions using cycle consistency.
- Introduces a continuous relaxation of discrete variables via learned embeddings, enabling gradient flow through discrete tokens during backpropagation.
- Applies Jacobian norm regularization to stabilize training and reduce sensitivity to weight initialization, improving convergence across all runs.
- Uses a timing signal—specifically, learned positional embeddings concatenated to input embeddings—to preserve sequence structure, especially critical for Vigenère ciphers.
- Employs a discriminator that operates on reconstructed sequences and compares them to real ones, enforcing fidelity through adversarial training.
- Trains using a combination of adversarial loss, cycle-consistency loss, and a gradient penalty (with α=10) to improve training stability and generalization.
Experimental results
Research questions
- RQ1Can a GAN-based model learn to reverse-engineer cipher mappings from unpaired plaintext and ciphertext sequences without human-annotated linguistic features?
- RQ2How can CycleGAN be stabilized and made effective for discrete, sequential data such as text, where standard GANs suffer from vanishing gradients and uninformative discrimination?
- RQ3Does operating in an embedding space with continuous relaxation mitigate the uninformative discrimination problem in discrete GANs?
- RQ4To what extent can such a model generalize across different cipher types (e.g., shift vs. Vigenère) and vocabulary sizes?
- RQ5Can the model achieve high accuracy on large-vocabulary ciphers (e.g., 200-word vocab) where prior methods have struggled?
Key findings
- CipherGAN achieved 100% accuracy on shift ciphers with a 10-word vocabulary and 98.7% accuracy with a 200-word vocabulary, demonstrating robustness across vocabulary sizes.
- On Vigenère ciphers with a key length of 3, the model achieved 99.7% accuracy on character-level mapping and 75.7% on word-level mapping, significantly outperforming baseline frequency analysis.
- The model showed near-perfect consistency across training runs, with no failed runs—unlike the original CycleGAN, which succeeded in only ~50% of training runs.
- The use of positional embeddings (specifically, concatenating learned position vectors) improved Vigenère cipher performance significantly, though it limited generalization to longer sequences.
- The model's initial mappings were consistently correct for the most frequent characters, indicating that it leverages frequency statistics, similar to classical cryptanalysis.
- The model frequently confused punctuation marks, suggesting that their skip-gram embeddings were too similar, leading to persistent misclassification.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.