# kishan-rao/cryptolab architecture

> Architecture diagram of the GitHub repository kishan-rao/cryptolab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kishan-rao/cryptolab
- Repository: https://github.com/kishan-rao/cryptolab

## Overview

This is an educational cryptography visualizer: users choose Vigenère, AES-128, or RSA, submit encryption/decryption inputs (and RSA key-generation parameters), then inspect returned results and step traces. The React pages call a FastAPI API; service classes adapt requests to from-scratch cipher implementations and build typed responses. The graph retains the documented cipher families, AES round/key-schedule inspection, RSA derivation and block traces, and Vigenère steps. Source excerpts support the backend calls; some frontend-to-API and UI-component relationships are only partially shown, so those links are marked unverified.

Main entry points: [`frontend/src/pages/AES.jsx`](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/AES.jsx) (AES Page), [`frontend/src/App.jsx`](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/App.jsx) (Page Router), [`frontend/src/pages/Vigenere.jsx`](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/Vigenere.jsx) (Vigenère Page), [`frontend/src/pages/RSA.jsx`](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/RSA.jsx) (RSA Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Visualizer UI"]
  node_app["Page Router<br/>[App.jsx]"]
  node_home["Algorithm Home<br/>[Home.jsx]"]
  node_vpage["Vigenère Page<br/>[Vigenere.jsx]"]
  node_apage["AES Page<br/>[AES.jsx]"]
  node_rpage["RSA Page<br/>[RSA.jsx]"]
  node_input["Input Panel<br/>[InputPanel.jsx]"]
  node_output["Output Panel<br/>[OutputPanel.jsx]"]
  node_stepview["Step Viewer<br/>[StepViewer.jsx]"]
  node_stateview["State Matrix<br/>[StateMatrix.jsx]"]
  node_formatter["Display Formatters<br/>[formatters.js]"]
  node_client["HTTP Client<br/>[api.js]"]
end

subgraph group_api["API Layer"]
  node_fastapi["FastAPI App<br/>[main.py]"]
  node_vroute["Vigenère Routes<br/>[vigenere.py]"]
  node_aroute["AES Routes<br/>[aes.py]"]
  node_rroute["RSA Routes<br/>[rsa.py]"]
end

subgraph group_services["Domain Services"]
  node_vservice["Vigenère Service"]
  node_aservice["AES Service<br/>[aes_service.py]"]
  node_rservice["RSA Service<br/>[rsa_service.py]"]
end

subgraph group_algorithms["Cipher Algorithms"]
  node_vigenere["Vigenère Cipher<br/>[vigenere.py]"]
  node_aes["AES-128<br/>[aes.py]"]
  node_rsa["RSA<br/>[rsa.py]"]
end

subgraph group_support["Schemas and Utilities"]
  node_vschema["Vigenère Schemas<br/>[vigenere.py]"]
  node_aschema["AES Schemas<br/>[aes.py]"]
  node_rschema["RSA Schemas<br/>[rsa.py]"]
  node_encoding["Encoding Helpers<br/>[encoding.py]"]
  node_math["Math Helpers<br/>[math_utils.py]"]
end

node_user(("Learner"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_vpage
node_app -->|"routes to"| node_apage
node_app -->|"routes to"| node_rpage
node_vpage -.->|"calls"| node_client
node_apage -.->|"calls"| node_client
node_rpage -.->|"calls"| node_client
node_vpage -->|"uses"| node_input
node_vpage -->|"uses"| node_output
node_vpage -->|"uses"| node_stepview
node_apage -->|"uses"| node_input
node_apage -->|"uses"| node_output
node_apage -->|"uses"| node_stateview
node_apage -->|"uses"| node_formatter
node_rpage -->|"uses"| node_input
node_rpage -->|"uses"| node_output
node_output -->|"formats with"| node_formatter
node_client -.->|"HTTP requests"| node_fastapi
node_fastapi -->|"registers"| node_vroute
node_fastapi -->|"registers"| node_aroute
node_fastapi -->|"registers"| node_rroute
node_vroute -->|"dispatches"| node_vservice
node_aroute -->|"dispatches"| node_aservice
node_rroute -->|"dispatches"| node_rservice
node_vroute -->|"validates with"| node_vschema
node_aroute -->|"validates with"| node_aschema
node_rroute -->|"validates with"| node_rschema
node_vservice -->|"invokes"| node_vigenere
node_aservice -->|"invokes"| node_aes
node_rservice -->|"invokes"| node_rsa
node_vservice -->|"builds responses"| node_vschema
node_aservice -->|"builds responses"| node_aschema
node_rservice -->|"builds responses"| node_rschema
node_aservice -->|"converts hex"| node_encoding
node_aes -->|"converts state"| node_encoding
node_aschema -->|"normalizes hex"| node_encoding
node_rsa -->|"uses math helpers"| node_math

click node_app "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/Home.jsx"
click node_vpage "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/Vigenere.jsx"
click node_apage "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/AES.jsx"
click node_rpage "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/RSA.jsx"
click node_input "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/components/InputPanel.jsx"
click node_output "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/components/OutputPanel.jsx"
click node_stepview "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/components/StepViewer.jsx"
click node_stateview "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/components/StateMatrix.jsx"
click node_formatter "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/utils/formatters.js"
click node_client "https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/services/api.js"
click node_fastapi "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/main.py"
click node_vroute "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/api/routes/vigenere.py"
click node_aroute "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/api/routes/aes.py"
click node_rroute "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/api/routes/rsa.py"
click node_vservice "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/services/vigenere_service.py"
click node_aservice "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/services/aes_service.py"
click node_rservice "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/services/rsa_service.py"
click node_vigenere "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/algorithms/classical/vigenere.py"
click node_aes "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/algorithms/symmetric/aes.py"
click node_rsa "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/algorithms/asymmetric/rsa.py"
click node_vschema "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/schemas/vigenere.py"
click node_aschema "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/schemas/aes.py"
click node_rschema "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/schemas/rsa.py"
click node_encoding "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/utils/encoding.py"
click node_math "https://github.com/kishan-rao/cryptolab/blob/main/backend/app/utils/math_utils.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_app,node_home,node_vpage,node_apage,node_rpage,node_input,node_output,node_stepview,node_stateview,node_formatter,node_client toneBlue
class node_fastapi,node_vroute,node_aroute,node_rroute toneAmber
class node_vservice,node_aservice,node_rservice toneMint
class node_vigenere,node_aes,node_rsa toneRose
class node_vschema,node_aschema,node_rschema,node_encoding,node_math,node_user toneIndigo
```

## Components

### Visualizer UI

- [Page Router](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Algorithm Home](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Vigenère Page](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/Vigenere.jsx): `frontend/src/pages/Vigenere.jsx`
- [AES Page](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/AES.jsx): `frontend/src/pages/AES.jsx`
- [RSA Page](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/pages/RSA.jsx): `frontend/src/pages/RSA.jsx`
- [Input Panel](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/components/InputPanel.jsx): `frontend/src/components/InputPanel.jsx`
- [Output Panel](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/components/OutputPanel.jsx): `frontend/src/components/OutputPanel.jsx`
- [Step Viewer](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/components/StepViewer.jsx): `frontend/src/components/StepViewer.jsx`
- [State Matrix](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/components/StateMatrix.jsx): `frontend/src/components/StateMatrix.jsx`
- [Display Formatters](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/utils/formatters.js): `frontend/src/utils/formatters.js`
- [HTTP Client](https://github.com/kishan-rao/cryptolab/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API Layer

- [FastAPI App](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/main.py): `backend/app/main.py`
- [Vigenère Routes](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/api/routes/vigenere.py): `backend/app/api/routes/vigenere.py`
- [AES Routes](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/api/routes/aes.py): `backend/app/api/routes/aes.py`
- [RSA Routes](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/api/routes/rsa.py): `backend/app/api/routes/rsa.py`

### Domain Services

- [Vigenère Service](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/services/vigenere_service.py): `backend/app/services/vigenere_service.py`
- [AES Service](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/services/aes_service.py): `backend/app/services/aes_service.py`
- [RSA Service](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/services/rsa_service.py): `backend/app/services/rsa_service.py`

### Cipher Algorithms

- [Vigenère Cipher](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/algorithms/classical/vigenere.py): `backend/app/algorithms/classical/vigenere.py`
- [AES-128](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/algorithms/symmetric/aes.py): `backend/app/algorithms/symmetric/aes.py`
- [RSA](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/algorithms/asymmetric/rsa.py): `backend/app/algorithms/asymmetric/rsa.py`

### Schemas and Utilities

- [Vigenère Schemas](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/schemas/vigenere.py): `backend/app/schemas/vigenere.py`
- [AES Schemas](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/schemas/aes.py): `backend/app/schemas/aes.py`
- [RSA Schemas](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/schemas/rsa.py): `backend/app/schemas/rsa.py`
- [Encoding Helpers](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/utils/encoding.py): `backend/app/utils/encoding.py`
- [Math Helpers](https://github.com/kishan-rao/cryptolab/blob/main/backend/app/utils/math_utils.py): `backend/app/utils/math_utils.py`

### Other components

- **Learner**

## Connections

- Learner → Page Router: opens (evidence: `frontend/src/App.jsx`)
- Page Router → Algorithm Home: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → Vigenère Page: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → AES Page: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → RSA Page: routes to (evidence: `frontend/src/App.jsx`)
- Vigenère Page → HTTP Client: calls (evidence: `frontend/src/pages/Vigenere.jsx`)
- AES Page → HTTP Client: calls (evidence: `frontend/src/pages/AES.jsx`)
- RSA Page → HTTP Client: calls (evidence: `frontend/src/pages/RSA.jsx`)
- Vigenère Page → Input Panel: uses (evidence: `frontend/src/pages/Vigenere.jsx`)
- Vigenère Page → Output Panel: uses (evidence: `frontend/src/pages/Vigenere.jsx`)
- Vigenère Page → Step Viewer: uses (evidence: `frontend/src/pages/Vigenere.jsx`)
- AES Page → Input Panel: uses (evidence: `frontend/src/pages/AES.jsx`)
- AES Page → Output Panel: uses (evidence: `frontend/src/pages/AES.jsx`)
- AES Page → State Matrix: uses (evidence: `frontend/src/pages/AES.jsx`)
- AES Page → Display Formatters: uses (evidence: `frontend/src/pages/AES.jsx`)
- RSA Page → Input Panel: uses (evidence: `frontend/src/pages/RSA.jsx`)
- RSA Page → Output Panel: uses (evidence: `frontend/src/pages/RSA.jsx`)
- Output Panel → Display Formatters: formats with (evidence: `frontend/src/components/OutputPanel.jsx`)
- HTTP Client → FastAPI App: HTTP requests
- FastAPI App → Vigenère Routes: registers (evidence: `backend/app/main.py`)
- FastAPI App → AES Routes: registers (evidence: `backend/app/main.py`)
- FastAPI App → RSA Routes: registers (evidence: `backend/app/main.py`)
- Vigenère Routes → Vigenère Service: dispatches (evidence: `backend/app/api/routes/vigenere.py`)
- AES Routes → AES Service: dispatches (evidence: `backend/app/api/routes/aes.py`)
- RSA Routes → RSA Service: dispatches (evidence: `backend/app/api/routes/rsa.py`)
- Vigenère Routes → Vigenère Schemas: validates with (evidence: `backend/app/api/routes/vigenere.py`)
- AES Routes → AES Schemas: validates with (evidence: `backend/app/api/routes/aes.py`)
- RSA Routes → RSA Schemas: validates with (evidence: `backend/app/api/routes/rsa.py`)
- Vigenère Service → Vigenère Cipher: invokes (evidence: `backend/app/services/vigenere_service.py`)
- AES Service → AES-128: invokes (evidence: `backend/app/services/aes_service.py`)
- RSA Service → RSA: invokes (evidence: `backend/app/services/rsa_service.py`)
- Vigenère Service → Vigenère Schemas: builds responses (evidence: `backend/app/services/vigenere_service.py`)
- AES Service → AES Schemas: builds responses (evidence: `backend/app/services/aes_service.py`)
- RSA Service → RSA Schemas: builds responses (evidence: `backend/app/services/rsa_service.py`)
- AES Service → Encoding Helpers: converts hex (evidence: `backend/app/services/aes_service.py`)
- AES-128 → Encoding Helpers: converts state (evidence: `backend/app/algorithms/symmetric/aes.py`)
- AES Schemas → Encoding Helpers: normalizes hex (evidence: `backend/app/schemas/aes.py`)
- RSA → Math Helpers: uses math helpers (evidence: `backend/app/algorithms/asymmetric/rsa.py`)
