> 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/symmetric-cryptography/aes/block-encryption-procedure.md).

# Block Encryption procedure

To encrypt, AES applies 4 distinct functions to the Plain Text in a specific and repetitive order, each of which is reversible (in order to be able to decrypt later)

{% @mermaid/diagram content="graph LR
Plain(PlainText)
addKey(Key Addition Layer)
Cipher(CypherText)
subgraph round
Sub(Byte Substitution Layer)
Shift(Diffusion : Shift Row Layer)
Mix(Diffusion : Mix Column Layer)
addKey2(Key Addition Layer)
Sub --> Shift --> Mix --> addKey2
end
Plain --> addKey  --> round --- repet(\[Repetition n times]) --> round
round --> Cipher" %}

{% hint style="info" %}
Every rounds made these four operations except the last one where the Mix Column is skipped
{% endhint %}

## Resources

* <https://www.angelfire.com/biz7/atleast/mix_columns.pdf>
* <https://engineering.purdue.edu/kak/compsec/NewLectures/Lecture8.pdf>

{% embed url="<https://github.com/francisrstokes/githublog/blob/main/2022/6/15/rolling-your-own-crypto-aes.md>" %}

{% embed url="<https://www.utc.fr/~wschon/sr06/txPHP/aes/MixColumn/MixColumn.php>" %}
