# uzukhai/python-aes-encryption architecture

> Architecture diagram of the GitHub repository uzukhai/python-aes-encryption, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/uzukhai/python-aes-encryption
- Repository: https://github.com/uzukhai/python-aes-encryption

## Overview

This is a small, pure-Python AES-128 block-encryption demonstration. A user runs the script with its fixed 16-character plaintext and key; the script converts them to state matrices, applies the initial key XOR and ten AES rounds, then formats and prints hexadecimal and Base64 results. Key expansion is implemented inside the AddRoundKey module. The README documents the single-block, ECB-style behavior and major AES stages; the graph follows calls visible in the excerpted script and does not imply calls between transformation modules.

Main entry points: [`AES.py`](https://github.com/uzukhai/python-aes-encryption/blob/main/AES.py) (AES runner), [`SubBytes.py`](https://github.com/uzukhai/python-aes-encryption/blob/main/SubBytes.py) (SubBytes), [`ShiftRow.py`](https://github.com/uzukhai/python-aes-encryption/blob/main/ShiftRow.py) (ShiftRows), [`MixColumns.py`](https://github.com/uzukhai/python-aes-encryption/blob/main/MixColumns.py) (MixColumns)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_driver["Encryption driver"]
  node_aes["AES runner<br/>[AES.py]"]
  node_printed["Printed result<br/>[AES.py]"]
end

subgraph group_rounds["AES transformations"]
  node_sub["SubBytes<br/>[SubBytes.py]"]
  node_shift["ShiftRows<br/>[ShiftRow.py]"]
  node_mix["MixColumns<br/>[MixColumns.py]"]
  node_key["Key schedule and XOR<br/>[AddRoundKey.py]"]
end

subgraph group_encoding["Input and output"]
  node_input["Text conversion<br/>[HexTransform.py]"]
  node_output["Hex and Base64<br/>[ConvertText.py]"]
end

node_user(("User"))

node_user -->|"runs script"| node_aes
node_aes -->|"converts text and key"| node_input
node_aes -->|"applies round key"| node_key
node_aes -->|"substitutes bytes"| node_sub
node_aes -->|"shifts rows"| node_shift
node_aes -->|"mixes columns"| node_mix
node_aes -->|"formats state"| node_output
node_aes -->|"prints result"| node_printed

click node_aes "https://github.com/uzukhai/python-aes-encryption/blob/main/AES.py"
click node_input "https://github.com/uzukhai/python-aes-encryption/blob/main/HexTransform.py"
click node_sub "https://github.com/uzukhai/python-aes-encryption/blob/main/SubBytes.py"
click node_shift "https://github.com/uzukhai/python-aes-encryption/blob/main/ShiftRow.py"
click node_mix "https://github.com/uzukhai/python-aes-encryption/blob/main/MixColumns.py"
click node_key "https://github.com/uzukhai/python-aes-encryption/blob/main/AddRoundKey.py"
click node_output "https://github.com/uzukhai/python-aes-encryption/blob/main/ConvertText.py"
click node_printed "https://github.com/uzukhai/python-aes-encryption/blob/main/AES.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_aes,node_printed,node_user toneBlue
class node_sub,node_shift,node_mix,node_key toneAmber
class node_input,node_output toneMint
```

## Components

### Encryption driver

- [AES runner](https://github.com/uzukhai/python-aes-encryption/blob/main/AES.py): `AES.py`
- [Printed result](https://github.com/uzukhai/python-aes-encryption/blob/main/AES.py): `AES.py`

### AES transformations

- [SubBytes](https://github.com/uzukhai/python-aes-encryption/blob/main/SubBytes.py): `SubBytes.py`
- [ShiftRows](https://github.com/uzukhai/python-aes-encryption/blob/main/ShiftRow.py): `ShiftRow.py`
- [MixColumns](https://github.com/uzukhai/python-aes-encryption/blob/main/MixColumns.py): `MixColumns.py`
- [Key schedule and XOR](https://github.com/uzukhai/python-aes-encryption/blob/main/AddRoundKey.py): `AddRoundKey.py`

### Input and output

- [Text conversion](https://github.com/uzukhai/python-aes-encryption/blob/main/HexTransform.py): `HexTransform.py`
- [Hex and Base64](https://github.com/uzukhai/python-aes-encryption/blob/main/ConvertText.py): `ConvertText.py`

### Other components

- **User**

## Connections

- User → AES runner: runs script (evidence: `README.md`)
- AES runner → Text conversion: converts text and key (evidence: `AES.py`)
- AES runner → Key schedule and XOR: applies round key (evidence: `AES.py`)
- AES runner → SubBytes: substitutes bytes (evidence: `AES.py`)
- AES runner → ShiftRows: shifts rows (evidence: `AES.py`)
- AES runner → MixColumns: mixes columns (evidence: `AES.py`)
- AES runner → Hex and Base64: formats state (evidence: `AES.py`)
- AES runner → Printed result: prints result (evidence: `AES.py`)
