---
title: "Cryptanalysis and Frequency Analysis: Breaking Classical Alphabetic Ciphers"
date: 2026-05-18
canonical: "https://codeandcypher.com/papers/csol510-breaking-alphabetic-ciphers/"
author: "Joshua A. Wortz"
institution: "University of San Diego"

report_type: "Academic Research Paper / CSOL510"
doi: "10.5281/zenodo.22287555"
pdf_url: "https://codeandcypher.com/papers/csol510-breaking-alphabetic-ciphers.pdf"
description: "Cryptanalytic study of classical substitution ciphers, frequency analysis, and mathematical foundations of modern symmetric cryptography."
---

# Cryptanalysis and Frequency Analysis: Breaking Classical Alphabetic Ciphers

**Author:** Joshua A. Wortz, MSCOL, CISSP ([ORCID: 0009-0003-6722-1019](https://orcid.org/0009-0003-6722-1019))  
**Institution:** University of San Diego  
**Publication Date:** May 18, 2026  
**DOI:** [10.5281/zenodo.22287555](https://doi.org/10.5281/zenodo.22287555)  
**PDF Download:** [Full Research Paper PDF](https://codeandcypher.com/papers/csol510-breaking-alphabetic-ciphers.pdf)  

---

## Abstract

This technical documentation outlines the systematic recovery and programmatic decoding of two distinct historical encryption schemes: a standard mono-alphabetic substitution and a multi-index poly-alphabetic Vigenère cipher. The analytical objective was fulfilled by engineering dedicated Python-based decryption utilities (mono_decoder.py and poly_decoder.py) that leverage linguistic character distributions, n-gram patterns, and multi-restart search heuristics.

---

## Research Paper Body

Assignment 2.1: Breaking Alphabetic Ciphers
Executive Summary & Overview
This technical documentation outlines the systematic recovery and programmatic 
decoding of two distinct historical encryption schemes: a standard mono-alphabetic substitution 
and a multi-index poly-alphabetic Vigenère cipher. The analytical objective was fulfilled by 
engineering dedicated Python-based decryption utilities (mono_decoder.py and 
poly_decoder.py) that leverage linguistic character distributions, n-gram patterns, and 
multi-restart search heuristics.
The resulting data streams were successfully reconstituted and cross-referenced with 
established archival records. The mono-alphabetic investigation identified the source as 
Abraham Lincoln's Gettysburg Address, resolved through an optimized stochastic hill-climbing 
routine. Concurrently, the poly-alphabetic ciphertext was identified as the preamble of the 
Declaration of Independence, reconstructed using Kasiski examination and Index of Coincidence 
period analysis. Formal procedural steps, statistical verification logs, and recovered character 
mappings are provided in the following sections to maintain exhaustive technical fidelity.
Cryptanalysis of the Mono-Alphabetic Substitution Cipher
Methodology and Procedural Steps
1. Initial Frequency Mapping Extraction: The script ingested mono-
alphabetic.txt, removed non-alphabetic characters, and calculated absolute 
character counts. It generated a baseline decryption mapping by sorting the observed 
ciphertext character counts and pairing them directly with standard English letter 
frequencies, ordered by historical frequency expectations.

2. Multi-Restart Stochastic Hill-Climbing Optimization: Because direct frequency 
sorting produces localized errors due to text-specific structural variations, the system ran 
a heuristic local search to maximize semantic fit. The optimization routine completed a 
default array of 12 complete restarts, executing 20,000 optimization iterations per pass.
3. Multi-Tiered Fitness Evaluation Function: Candidate substitution keys were assessed 
by passing the translated string through a composite objective function that calculates a 
statistical fitness score based on language features:
● Log-Probability Quadgram Calculation: Individual four-letter clusters 
(quadgrams) extracted from the text stream were scored against a comprehensive 
English corpus using base-10 logarithmic probabilities. Unmapped or highly 
anomalous quadgrams were heavily penalized using a calculated minimum fitness 
floor.
● Weighted Monogram Deviation: The engine evaluated the absolute differences 
between the candidate text's character percentages and standard English letter 
frequency tables, applying a damping modifier to balance the weight across multi-
letter patterns.
● Structural Incentive Scoring: To reward natural English linguistic transitions, 
the engine added specific weight bonuses for confirmed matches within arrays of 
common components, including common digraphs, trigraphs, and double-letter 
groupings.
4. Local Minima Deflection and Termination Limits: To prevent the algorithm from 
getting trapped in sub-optimal local configurations, each loop iteration maintained a 
0.08% random mutation jump probability. It also resets the working state to the global

maximum every 5,000 cycles. The processing engine executed an early stop once 3 
consecutive restarts failed to improve the global best score.
python mono_decoder.py --input mono-alphabetic.txt --show-ngrams --
show-map --output mono-guess.txt
Recovered Key Mapping
The programmatic optimization successfully converged on the complete cipher-to-
plaintext substitution key. The validated mappings are detailed below using formal substitution 
notation:
Cipher → Plain Cipher → Plain Cipher → Plain Cipher → Plain
a → y h → v n → q u → p
b → x i → e o → l v → d
c → b j → f p → j w → k

d → c k → r q → t x → h
e → o j → f r → s y → u
f → w l → n s → a z → z
g → g m → m t → i Unused: 
Recovered Plaintext and Source
● Historical Source: President Abraham Lincoln's Gettysburg Address, delivered on 
November 19, 1863, at the dedication of the Soldiers' National Cemetery in Gettysburg, 
Pennsylvania.
● Recovered Plaintext Text:
"Four score and seven years ago our fathers brought forth on this continent a new 
nation, conceived in liberty and dedicated to the proposition that all men are created 
equal. Now we are engaged in a great civil war, testing whether that nation, or any

nation so conceived and so dedicated, can long endure. We are met on a great battle-
field of that war. We have come to dedicate a portion of that field, as a final resting 
place for those who here gave their lives that that nation might live. It is altogether 
fitting and proper that we should do this. But, in a larger sense, we can not dedicate -- 
we can not consecrate -- we can not hallow -- this ground. The brave men, living and 
dead, who struggled here, have consecrated it, far above our poor power to add or 
detract. The world will little note, nor long remember what we say here, but it can never 
forget what they did here. It is for us, the living, rather, to be dedicated here to the 
unfinished work which they who fought here have thus far so nobly advanced. It is 
rather for us to be here dedicated to the great task remaining before us -- that from these 
honored dead we take increased devotion to that cause for which they gave the last full 
measure of devotion -- that we here highly resolve that these dead shall not have died in 
vain -- that this nation, under god, shall have a new birth of freedom -- and that 
government of the people, by the people, for the people, shall not perish from the 
earth."
Cryptanalysis of the Poly-Alphabetic (Vigenère) Cipher
3.1 Algorithmic Methodology and Procedural Steps
Polyalphabetic substitution ciphers attempt to hide character statistics by shifting 
plaintext letters through a series of alternating Caesar ciphers, guided by a repeating keyword. 
This mechanism flattens the standard single-letter frequency distribution profile.

The programmatic utility poly_decoder.py bypassed this defense by isolating the key 
period length and running a column-by-column optimization test:
1. Key Length Identification Matrix: The program ran two separate analytical procedures 
to discover the hidden key length:
○ Kasiski Examination: The script scanned the entire text stream for repeating sets 
of characters (trigrams and quadgrams). It recorded the distances separating these 
matching phrases and extracted their common factors to check for a repeating 
period cycle.
○ Index of Coincidence (IC) Column Variance Analysis: To confirm the cycle 
length, the ciphertext string was partitioned into distinct column vectors matching 
tentative key lengths. The script calculated the average Index of Coincidence 
across these column sets, measuring how closely the letter distributions matched a 
standard language pattern versus a randomized distribution. The correct period 
length was identified when the average IC shifted sharply from a randomized 
language distribution to a standard English baseline. This confirmed an optimal 
key length of 11.
2. Frequency Alignment via Chi-Squared Goodness-of-Fit Testing: Once the period 
length of 11 was locked, the ciphertext text stream was split into eleven independent 
slices. Because each slice was encrypted using a single repeating-character shift, it 
functioned as a standard monoalphabetic Caesar cipher. The program performed an 
exhaustive 26-step character-shift rotation across each slice, evaluating the resulting 
frequency distributions against expected English-language probabilities using a

goodness-of-fit calculation. The shift iteration that minimized the statistical discrepancy 
for each column successfully extracted the true encryption key character for that slice.
python poly_decoder.py --input poly-alphabetic.txt --show-
analysis --output poly-guess.txt
Recovered Key and Period Length
● Recovered Key Length: 11 Characters
● Recovered Keyword: DECLARATION
Recovered Plaintext and Source
● Historical Source: The United States Declaration of Independence, primarily drafted by 
Thomas Jefferson and adopted by the Continental Congress on July 4, 1776 (specifically 
focusing on the preamble).
● Recovered Plaintext Text:
WEHOLDTHESETRUTHSTOBESELFEVIDENTTHATALLMENARECREATEDEQUALTHATTHE
YAREENDOWEDBYTHE
IRCREATORWITHCERTAINUNALIENABLERIGHTSTHATAMONGTHESEARELIFELIBERT
YANDTHEPURSUITOFHA
PPINESSTHATTOSECURETHESERIGHTSGOVERNMENTSAREINSTITUTEDAMONGMENDE
RIVINGTHEIRJUSTPOWE
RSFROMTHECONSENTOFTHEGOVERNEDTHATWHENEVERANYFORMOFGOVERNMENTBECO
MESDESTRUCTIV

EOFTHESEENDSITISTHERIGHTOFTHEPEOPLETOALTERORABOLISHITANDTOINSTIT
UTENEWGOVERNMENT
LAYINGITSFOUNDATIONONSUCHPRINCIPLESANDORGANIZINGITSPOWERSINSUCHF
ORMASTOTHEMSHALLSE
EMMOSTLIKELYTOEFFECTTHEIRSAFETYANDHAPPINESS...
Experimental Evidence and Program Logs
Screenshot 1: Mono-Alphabetic Execution and Optimization Output 1 of 4

Screenshot 2: Mono-Alphabetic Execution and Optimization Output 2 of 4

Screenshot 3: Mono-Alphabetic Execution and Optimization Output 3 of 4

Screenshot 4: Mono-Alphabetic Execution and Optimization Output 4 of 4

Screenshot 5: Vigenère Analytical Profiling and Chi-Squared Output
Conclusion and Cryptographic Insights
The experimental exercises confirm that classical substitution methods provide zero 
semantic defense against automated statistical parsing and modern mathematical analytics.
A mono-alphabetic system completely fails to defend text due to stable single-character 
distributions. Furthermore, while a poly-alphabetic system complicates matters by dispersing 
singular distributions across multiple indices, it remains entirely vulnerable once the key 
repetition cycle length is calculated via Kasiski examination or Index of Coincidence analysis. In

professional environments, true cryptographic confidentiality demands the elimination of key 
reuse and architectural designs that ensure deep confusion, diffusion, and exhaustive key spaces.

### References
GeeksforGeeks. (n.e.). TF – IDF for Bigrams & Trigrams. https://www.geeksforgeeks.org/tf-idf-
for-bigrams-trigrams/
Interactive Mathematics. (n.d.). Frequency Analysis: Breaking the Code. 
https://crypto.interactive-maths.com/frequency-analysis-breaking-the-code.html
Jefferson, T. (1776). The Declaration of Independence. United States Continental 
Congress.
Lincoln, A. (1863). The Gettysburg Address. Gettysburg, PA.
Research Optimus. (n.d.). What is Frequency Analysis? History and Definition of 
Frequency Analysis. https://www.researchoptimus.com/article/frequency-analysis.php
Singh, S. (n.d.). The Black Chamber Vigenère Cracking Tool. 
https://www.simonsingh.net/The_Black_Chamber/vigenere_cracking_tool.html
 Pro-Tips for Finalizing Your Submission:💡
1. Screen Captures: Run your Python tools directly inside your terminal, snap screenshots 
of the actual window execution screens, and swap out the console log placeholders in 
Section 4 with those images. Remember to keep the titles exactly as written to satisfy the 
rubric constraint ("Clear screenshots, when applicable, that include a title for each 
screen").

2. Formatting: If you paste this directly into Microsoft Word, add a standard APA cover 
page at the beginning and insert a page break right before the 6. References section to 
ensure a clean academic presentation.


---

> **Archival Artifact:** The complete, formatted research publication can be accessed directly as a PDF at [https://codeandcypher.com/papers/csol510-breaking-alphabetic-ciphers.pdf](https://codeandcypher.com/papers/csol510-breaking-alphabetic-ciphers.pdf).


---

## Citation (APA 7th Edition)
Wortz, J. A. (2026). *Cryptanalysis and Frequency Analysis: Breaking Classical Alphabetic Ciphers*. Code and Cypher. https://doi.org/10.5281/zenodo.22287555
