# pratiush-k/cryptpqc architecture

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

- Interactive diagram: https://gitdiagram.com/pratiush-k/cryptpqc
- Repository: https://github.com/pratiush-k/cryptpqc

## Overview

Crypt is a post-quantum cryptography assessment and migration toolkit. Users scan source code or a live TLS endpoint, review exposure and Mosca risk, and can explore a toy Shor attack or try hybrid encryption; the web UI and CLI expose overlapping backend capabilities. The hybrid API combines X25519 and ML-KEM key encapsulation with AES-GCM encryption. The graph preserves documented assistant and benchmark features. Some endpoint wiring and the benchmark implementation were not excerpted, so those links rely on README documentation or are omitted where unsupported.

Main entry points: [`app.py`](https://github.com/pratiush-k/cryptpqc/blob/main/app.py) (Flask API), [`cryptpqc/cli.py`](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/cli.py) (Command line), [`cryptpqc/assistant.py`](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/assistant.py) (Ask Crypt), [`web/app.js`](https://github.com/pratiush-k/cryptpqc/blob/main/web/app.js) (Web interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_web["Web interface<br/>[app.js]"]
  node_server["Flask API<br/>[app.py]"]
  node_cli["Command line<br/>[cli.py]"]
end

subgraph group_assessment["Exposure assessment"]
  node_scanner["Code scanner<br/>[scanner.py]"]
  node_tls["TLS endpoint scanner<br/>[tls_scan.py]"]
  node_mosca["Mosca risk calculator<br/>[risk.py]"]
end

subgraph group_education["Demos and guidance"]
  node_assistant["Ask Crypt<br/>[assistant.py]"]
  node_shor["Shor attack demo<br/>[shor_demo.py]"]
  node_bench["Scheme benchmarks<br/>[bench.py]"]
end

subgraph group_cryptography["Hybrid cryptography"]
  node_hybrid_api["Encryption API<br/>[api.py]"]
  node_kem["Hybrid key encapsulation<br/>[kem.py]"]
end

node_user(("User"))
node_groq["Groq service"]

node_user -->|"uses"| node_web
node_web -->|"calls API"| node_server
node_user -->|"runs commands"| node_cli
node_cli -->|"scans source"| node_scanner
node_cli -->|"runs benchmarks"| node_bench
node_server -->|"scans uploads"| node_scanner
node_server -->|"scans endpoint"| node_tls
node_server -->|"calculates risk"| node_mosca
node_server -->|"answers questions"| node_assistant
node_server -->|"runs demo"| node_shor
node_server -->|"encrypts message"| node_hybrid_api
node_server -->|"runs benchmarks"| node_bench
node_assistant -->|"recomputes verdict"| node_mosca
node_assistant -->|"requests answer"| node_groq
node_hybrid_api -->|"encapsulates secrets"| node_kem

click node_web "https://github.com/pratiush-k/cryptpqc/blob/main/web/app.js"
click node_server "https://github.com/pratiush-k/cryptpqc/blob/main/app.py"
click node_cli "https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/cli.py"
click node_scanner "https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/scanner.py"
click node_tls "https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/tls_scan.py"
click node_mosca "https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/risk.py"
click node_assistant "https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/assistant.py"
click node_shor "https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/shor_demo.py"
click node_bench "https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/bench.py"
click node_hybrid_api "https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/api.py"
click node_kem "https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/kem.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_web,node_server,node_cli,node_user toneBlue
class node_scanner,node_tls,node_mosca toneAmber
class node_assistant,node_shor,node_bench toneMint
class node_hybrid_api,node_kem toneRose
class node_groq toneIndigo
```

## Components

### User interfaces

- [Web interface](https://github.com/pratiush-k/cryptpqc/blob/main/web/app.js): `web/app.js`
- [Flask API](https://github.com/pratiush-k/cryptpqc/blob/main/app.py): `app.py`
- [Command line](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/cli.py): `cryptpqc/cli.py`

### Exposure assessment

- [Code scanner](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/scanner.py): `cryptpqc/scanner.py`
- [TLS endpoint scanner](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/tls_scan.py): `cryptpqc/tls_scan.py`
- [Mosca risk calculator](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/risk.py): `cryptpqc/risk.py`

### Demos and guidance

- [Ask Crypt](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/assistant.py): `cryptpqc/assistant.py`
- [Shor attack demo](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/shor_demo.py): `cryptpqc/shor_demo.py`
- [Scheme benchmarks](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/bench.py): `cryptpqc/bench.py`

### Hybrid cryptography

- [Encryption API](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/api.py): `cryptpqc/api.py`
- [Hybrid key encapsulation](https://github.com/pratiush-k/cryptpqc/blob/main/cryptpqc/kem.py): `cryptpqc/kem.py`

### Other components

- **User**
- **Groq service**

## Connections

- User → Web interface: uses (evidence: `README.md`)
- Web interface → Flask API: calls API (evidence: `README.md`)
- User → Command line: runs commands (evidence: `README.md`)
- Command line → Code scanner: scans source (evidence: `cryptpqc/cli.py`)
- Command line → Scheme benchmarks: runs benchmarks (evidence: `cryptpqc/cli.py`)
- Flask API → Code scanner: scans uploads (evidence: `app.py`)
- Flask API → TLS endpoint scanner: scans endpoint (evidence: `app.py`)
- Flask API → Mosca risk calculator: calculates risk (evidence: `app.py`)
- Flask API → Ask Crypt: answers questions (evidence: `app.py`)
- Flask API → Shor attack demo: runs demo (evidence: `README.md`)
- Flask API → Encryption API: encrypts message (evidence: `app.py`)
- Flask API → Scheme benchmarks: runs benchmarks (evidence: `README.md`)
- Ask Crypt → Mosca risk calculator: recomputes verdict (evidence: `cryptpqc/assistant.py`)
- Ask Crypt → Groq service: requests answer (evidence: `cryptpqc/assistant.py`)
- Encryption API → Hybrid key encapsulation: encapsulates secrets (evidence: `cryptpqc/api.py`)
