0Pricing
Cryptology Academy · Lesson

Frequency Analysis & Cryptanalysis Basics

Break classical ciphers using letter frequency statistics.

Frequency Analysis & Cryptanalysis Basics is a free Cryptology Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Welcome

Frequency analysis is the art of using statistical patterns in language to break substitution ciphers. It was discovered in 850 CE and is still relevant today.

English Letter Frequencies

The most frequent English letters (approx): E(12.7%), T(9.1%), A(8.2%), O(7.5%), I(7.0%), N(6.7%). If you see 'X' appearing 12% of the time in ciphertext, X likely represents E.

Building a Frequency Table

from collections import Counter def freq_table(text): letters = [c for c in text.upper() if c.isalpha()] counts = Counter(letters) total = len(letters) return {k: v/total for k,v in counts.most_common()}

Bigrams & Trigrams

Common English bigrams: TH, HE, IN, ER, AN. Common trigrams: THE, AND, ING, ION. These patterns survive substitution ciphers and accelerate decryption.

Index of Coincidence (IoC)

IoC = Σ(n_i * (n_i-1)) / (N*(N-1)). For English IoC ≈ 0.065. For random text IoC ≈ 0.038. High IoC means monoalphabetic substitution.

Applying IoC to Vigenère

Test key lengths 1..20. For each length k, split ciphertext into k groups. Compute average IoC. The true key length gives IoC closest to 0.065.

Caesar Attack via Frequency

For a Caesar cipher: find the most frequent ciphertext letter (likely E). Shift = (most_frequent - ord('E')) mod 26. Decrypt and verify readability.

Word Patterns

Short words leak patterns: a 1-letter word is usually 'A' or 'I'. A 3-letter word starting with 'the_' pattern often is 'the'. These constrain the substitution quickly.

Manual Attack Workflow

1. Count frequencies. 2. Map top ciphertext letters to top English letters (E,T,A,O,I). 3. Use bigrams/word patterns to fill gaps. 4. Iterate until readable.

Modern Relevance

Frequency analysis attacks modern cryptography when developers misuse primitives (e.g., ECB mode leaks block patterns). Understanding the principle prevents design errors.

Automated Cryptanalysis

Tools like dcode.fr and quipqiup.com automate substitution cipher attacks using dictionary patterns and hill-climbing algorithms, breaking 100-character ciphers in seconds.

Quick Check

What does a high Index of Coincidence (≈0.065) indicate about a ciphertext?

Recap

Great work! Frequency analysis is a cornerstone of cryptanalysis. Next we move to modern crypto: number systems and modular arithmetic.

Frequently asked questions

Is the “Frequency Analysis & Cryptanalysis Basics” lesson free?

Yes — the full text of “Frequency Analysis & Cryptanalysis Basics” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.

What will I learn in “Frequency Analysis & Cryptanalysis Basics”?

Break classical ciphers using letter frequency statistics. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cryptology Academy?

No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Frequency Analysis & Cryptanalysis Basics” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cryptology Academy lesson?

Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Caesar Cipher Mechanics
  2. Atbash & Affine Ciphers
  3. Vigenère & Polyalphabetic Ciphers
  4. Frequency Analysis & Cryptanalysis Basics
← Back to Cryptology Academy