# admiralty01/password-generator architecture

> Architecture diagram of the GitHub repository admiralty01/password-generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/admiralty01/password-generator
- Repository: https://github.com/admiralty01/password-generator

## Overview

#### Purpose and Entry Points
This repository implements a hybrid passphrase security suite: generate Diceware-style word passphrases with randomized symbols, calculate entropy, and estimate resistance to brute-force and dictionary attacks. Primary runtime entry points are the Python CLI in `password_generator_v1.py` and the web application bootstrap in `app.py`. HTTP endpoints are defined in `api/routes.py`; the server-rendered UI resides in `templates/index.html`.

#### Application Boundary
`app.py` is the application composition root, connecting the web runtime to API routing. `api/routes.py` forms the external request boundary for generation and evaluation operations, translating browser/API inputs into calls on the core domain. `templates/index.html` is the delivered browser interface; the `stitch_hybrid_passphrase_security_suite/` HTML files are design/prototype artifacts rather than the implemented runtime UI.

#### Passphrase Generation
`core/generator.py` owns secure hybrid-passphrase construction. It draws semantic tokens from `eff_large_wordlist.txt` and combines them with symbol patterns, preserving word boundaries for memorability while expanding the attack search space. Both the CLI (`password_generator_v1.py`) and API layer (`api/routes.py`) should consume this component rather than independently implementing selection logic.

#### Entropy Modeling
`core/entropy.py` provides the security math for the generated structure: word-list selection space plus symbol/pattern choices. This is a domain boundary between raw generation parameters/passphrase composition and user-facing strength metrics. The EFF list at `eff_large_wordlist.txt` is a material security asset: its cardinality and contents directly determine word-selection entropy.

#### Evaluation and Attack Simulation
`core/evaluator.py` converts entropy or passphrase characteristics into security assessments, including brute-force crack-time estimates across hardware profiles and dictionary-resistance grading. `core/benchmark.py` supports comparative analysis between the hybrid scheme and conventional random-character approaches. These stages feed presentation clients with explanatory security outcomes, rather than acting as password storage or authentication infrastructure.

#### CLI Flow
`password_generator_v1.py` accepts generation parameters such as word and symbol counts, invokes generation and evaluation capabilities, then prints ANSI-formatted results. It is a standalone local execution path and does not require web infrastructure. Its control flow is: parse arguments → generate hybrid passphrase → calculate entropy → evaluate crack resistance → render terminal report.

#### Web/API Flow and Runtime Dependencies
The browser requests generation/evaluation actions through `api/routes.py`; routes invoke `core/generator.py`, `core/entropy.py`, and `core/evaluator.py`, then return results for `templates/index.html` to display. Python dependencies are declared in `requirements.txt`. No database, cloud service, identity provider, or remote entropy service is represented; generation is intended to remain local to the executing process. `eff_large_wordlist_raw.txt` appears to be a source/raw variant of the curated runtime word list.

Main entry points: [`api/routes.py`](https://github.com/admiralty01/password-generator/blob/main/api/routes.py) (HTTP routes), [`core/entropy.py`](https://github.com/admiralty01/password-generator/blob/main/core/entropy.py) (Entropy model), [`password_generator_v1.py`](https://github.com/admiralty01/password-generator/blob/main/password_generator_v1.py) (Passphrase CLI), [`app.py`](https://github.com/admiralty01/password-generator/blob/main/app.py) (Web bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Application"]
  node_app["Web bootstrap<br/>Python app<br/>[app.py]"]
  node_routes["HTTP routes<br/>API boundary<br/>[routes.py]"]
  node_ui["Browser UI<br/>HTML template<br/>[index.html]"]
end

subgraph group_cli["CLI"]
  node_cli_entry["Passphrase CLI<br/>Python CLI"]
end

subgraph group_core["Security Core"]
  node_generator{{"Hybrid generator<br/>domain service<br/>[generator.py]"}}
  node_entropy{{"Entropy model<br/>domain service<br/>[entropy.py]"}}
  node_evaluator{{"Security evaluator<br/>domain service<br/>[evaluator.py]"}}
  node_benchmark["Scheme benchmark<br/>analysis service<br/>[benchmark.py]"]
end

subgraph group_assets["Wordlist Assets"]
  node_wordlist["Curated EFF wordlist<br/>security asset"]
  node_raw_wordlist["Raw wordlist source<br/>source asset"]
end

node_dependencies["Python dependencies<br/>runtime manifest<br/>[requirements.txt]"]

node_app -->|"mounts"| node_routes
node_app -->|"serves"| node_ui
node_ui -->|"requests actions"| node_routes
node_routes -->|"generates"| node_generator
node_routes -->|"calculates"| node_entropy
node_routes -->|"evaluates"| node_evaluator
node_cli_entry -->|"generates"| node_generator
node_cli_entry -->|"calculates"| node_entropy
node_cli_entry -->|"renders assessment"| node_evaluator
node_generator -->|"selects words"| node_wordlist
node_entropy -->|"uses cardinality"| node_wordlist
node_benchmark -->|"uses security math"| node_entropy
node_raw_wordlist -.->|"source variant"| node_wordlist
node_dependencies -.->|"provides runtime packages"| node_app

click node_app "https://github.com/admiralty01/password-generator/blob/main/app.py"
click node_routes "https://github.com/admiralty01/password-generator/blob/main/api/routes.py"
click node_ui "https://github.com/admiralty01/password-generator/blob/main/templates/index.html"
click node_cli_entry "https://github.com/admiralty01/password-generator/blob/main/password_generator_v1.py"
click node_generator "https://github.com/admiralty01/password-generator/blob/main/core/generator.py"
click node_entropy "https://github.com/admiralty01/password-generator/blob/main/core/entropy.py"
click node_evaluator "https://github.com/admiralty01/password-generator/blob/main/core/evaluator.py"
click node_benchmark "https://github.com/admiralty01/password-generator/blob/main/core/benchmark.py"
click node_wordlist "https://github.com/admiralty01/password-generator/blob/main/eff_large_wordlist.txt"
click node_raw_wordlist "https://github.com/admiralty01/password-generator/blob/main/eff_large_wordlist_raw.txt"
click node_dependencies "https://github.com/admiralty01/password-generator/blob/main/requirements.txt"

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_routes,node_ui toneBlue
class node_cli_entry toneAmber
class node_generator,node_entropy,node_evaluator,node_benchmark toneMint
class node_wordlist,node_raw_wordlist toneRose
class node_dependencies toneNeutral
```

## Components

### Web Application

- [Web bootstrap](https://github.com/admiralty01/password-generator/blob/main/app.py): Python app · Application composition root. · `app.py`
- [HTTP routes](https://github.com/admiralty01/password-generator/blob/main/api/routes.py): API boundary · Handles generation and evaluation requests. · `api/routes.py`
- [Browser UI](https://github.com/admiralty01/password-generator/blob/main/templates/index.html): HTML template · Server-rendered passphrase interface. · `templates/index.html`

### CLI

- [Passphrase CLI](https://github.com/admiralty01/password-generator/blob/main/password_generator_v1.py): Python CLI · Standalone local generation and reporting flow. · `password_generator_v1.py`

### Security Core

- [Hybrid generator](https://github.com/admiralty01/password-generator/blob/main/core/generator.py): domain service · Constructs Diceware words with randomized symbol patterns. · `core/generator.py`
- [Entropy model](https://github.com/admiralty01/password-generator/blob/main/core/entropy.py): domain service · Calculates word-selection and symbol-pattern entropy. · `core/entropy.py`
- [Security evaluator](https://github.com/admiralty01/password-generator/blob/main/core/evaluator.py): domain service · Estimates crack resistance and dictionary strength. · `core/evaluator.py`
- [Scheme benchmark](https://github.com/admiralty01/password-generator/blob/main/core/benchmark.py): analysis service · Compares hybrid passphrases with random-character approaches. · `core/benchmark.py`

### Wordlist Assets

- [Curated EFF wordlist](https://github.com/admiralty01/password-generator/blob/main/eff_large_wordlist.txt): security asset · Runtime word-selection space for Diceware generation and entropy. · `eff_large_wordlist.txt`
- [Raw wordlist source](https://github.com/admiralty01/password-generator/blob/main/eff_large_wordlist_raw.txt): source asset · Raw variant of the curated runtime list. · `eff_large_wordlist_raw.txt`

### Other components

- [Python dependencies](https://github.com/admiralty01/password-generator/blob/main/requirements.txt): runtime manifest · `requirements.txt`

## Connections

- Web bootstrap → HTTP routes: mounts
- Web bootstrap → Browser UI: serves
- Browser UI → HTTP routes: requests actions
- HTTP routes → Hybrid generator: generates
- HTTP routes → Entropy model: calculates
- HTTP routes → Security evaluator: evaluates
- Passphrase CLI → Hybrid generator: generates
- Passphrase CLI → Entropy model: calculates
- Passphrase CLI → Security evaluator: renders assessment
- Hybrid generator → Curated EFF wordlist: selects words
- Entropy model → Curated EFF wordlist: uses cardinality
- Scheme benchmark → Entropy model: uses security math
- Raw wordlist source → Curated EFF wordlist: source variant
- Python dependencies → Web bootstrap: provides runtime packages
