> For the complete documentation index, see [llms.txt](https://www.ctfrecipes.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.ctfrecipes.com/cryptography/mono-alphabetic-substitution/frequency-analysis.md).

# frequency analysis

Frequency analysis is a cryptanalysis technique used to break substitution ciphers, by analyzing the frequency of letters or groups of letters in the ciphertext.

The idea is that, in a given language, certain letters or combinations of letters appear more frequently than others. By counting the frequency of letters in the ciphertext, an attacker can compare it to the known letter frequency patterns in the language and make guesses about the substitution mapping used to encrypt the plaintext.

This information can then be used to partially or fully break the cipher, revealing the original message.

## How it works ?

For each letter in the alphabet, count how many time it appears, and then calculate the frequency and compare with the known value for a specific language.

{% hint style="warning" %}
Such as [Index of coincidence](/cryptography/mono-alphabetic-substitution/index-of-coincidence.md), more the text is longer, more this technique will works.
{% endhint %}

{% hint style="info" %}
For simple substitution, it can be useful to try replacing the most common letter in the ciphertext by the letter E, the most common letter in English, and so on.
{% endhint %}

## Resources

{% embed url="<https://www.dcode.fr/frequency-analysis>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.ctfrecipes.com/cryptography/mono-alphabetic-substitution/frequency-analysis.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
