# hashcat/hashcat-legacy architecture

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

- Interactive diagram: https://gitdiagram.com/hashcat/hashcat-legacy
- Repository: https://github.com/hashcat/hashcat-legacy

## Overview

Hashcat is a CPU-based password-recovery utility. Its principal workflow is to load target hashes, generate candidate passwords using an attack mode and optional transformations, compute hashes, compare them with targets, and report recovered plaintexts. The README documents seven attack modes and more than 100 hashing algorithms; the tree also shows rule, mask, charset, and algorithm implementations. The CLI and engine excerpts support the loading, dispatch, hashing, and comparison roles shown here; some attack-mode wiring and output persistence details are not sampled, so those connections are omitted.

Main entry points: [`src/hashcat-cli.c`](https://github.com/hashcat/hashcat-legacy/blob/master/src/hashcat-cli.c) (CLI and orchestration), [`src/engine.c`](https://github.com/hashcat/hashcat-legacy/blob/master/src/engine.c) (Hashing engine), [`src/rp.c`](https://github.com/hashcat/hashcat-legacy/blob/master/src/rp.c) (Rule transformations), [`rules`](https://github.com/hashcat/hashcat-legacy/tree/master/rules) (Rule collections)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Recovery workflow"]
  node_cli["CLI and orchestration<br/>[hashcat-cli.c]"]
  node_targets["Hash loading and indexing<br/>[hashcat-cli.c]"]
end

subgraph group_generation["Candidate generation"]
  node_attack_modes["Attack modes<br/>[hashcat-cli.c]"]
  node_wordlists["Word candidates"]
  node_rules["Rule transformations<br/>[rp.c]"]
  node_rule_sets["Rule collections"]
  node_masks["Mask patterns"]
  node_charsets["Charset definitions"]
end

subgraph group_compute["Hash computation"]
  node_engine["Hashing engine<br/>[engine.c]"]
  node_algorithms["Hash algorithms<br/>[engine.c]"]
  node_compare["Digest comparison<br/>[hashcat-cli.c]"]
end

subgraph group_results["Results and state"]
  node_recovered["Recovered passwords"]
  node_potfile[("Recovery state")]
end

node_operator(("Operator"))
node_target_input["Target hashes"]

node_operator -->|"invokes"| node_cli
node_target_input -->|"supplies hashes"| node_targets
node_cli -->|"loads targets"| node_targets
node_cli -->|"selects attack"| node_attack_modes
node_wordlists -->|"provides candidates"| node_attack_modes
node_rule_sets -->|"provides rules"| node_rules
node_masks -->|"provides patterns"| node_attack_modes
node_charsets -->|"provides characters"| node_attack_modes
node_attack_modes -->|"applies transforms"| node_rules
node_cli -->|"dispatches work"| node_engine
node_engine -->|"computes digests"| node_algorithms
node_engine -->|"submits digests"| node_compare
node_targets -->|"supplies targets"| node_compare
node_compare -->|"reports matches"| node_cli
node_cli -->|"emits plaintexts"| node_recovered
node_cli -.->|"records recovery state"| node_potfile

click node_cli "https://github.com/hashcat/hashcat-legacy/blob/master/src/hashcat-cli.c"
click node_targets "https://github.com/hashcat/hashcat-legacy/blob/master/src/hashcat-cli.c"
click node_attack_modes "https://github.com/hashcat/hashcat-legacy/blob/master/src/hashcat-cli.c"
click node_rules "https://github.com/hashcat/hashcat-legacy/blob/master/src/rp.c"
click node_rule_sets "https://github.com/hashcat/hashcat-legacy/tree/master/rules"
click node_masks "https://github.com/hashcat/hashcat-legacy/tree/master/masks"
click node_charsets "https://github.com/hashcat/hashcat-legacy/tree/master/charsets"
click node_engine "https://github.com/hashcat/hashcat-legacy/blob/master/src/engine.c"
click node_algorithms "https://github.com/hashcat/hashcat-legacy/blob/master/src/engine.c"
click node_compare "https://github.com/hashcat/hashcat-legacy/blob/master/src/hashcat-cli.c"

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_cli,node_targets toneBlue
class node_attack_modes,node_wordlists,node_rules,node_rule_sets,node_masks,node_charsets toneAmber
class node_engine,node_algorithms,node_compare toneMint
class node_recovered,node_potfile toneRose
class node_operator,node_target_input toneIndigo
```

## Components

### Recovery workflow

- [CLI and orchestration](https://github.com/hashcat/hashcat-legacy/blob/master/src/hashcat-cli.c): `src/hashcat-cli.c`
- [Hash loading and indexing](https://github.com/hashcat/hashcat-legacy/blob/master/src/hashcat-cli.c): `src/hashcat-cli.c`

### Candidate generation

- [Attack modes](https://github.com/hashcat/hashcat-legacy/blob/master/src/hashcat-cli.c): `src/hashcat-cli.c`
- **Word candidates**
- [Rule transformations](https://github.com/hashcat/hashcat-legacy/blob/master/src/rp.c): `src/rp.c`
- [Rule collections](https://github.com/hashcat/hashcat-legacy/tree/master/rules): `rules`
- [Mask patterns](https://github.com/hashcat/hashcat-legacy/tree/master/masks): `masks`
- [Charset definitions](https://github.com/hashcat/hashcat-legacy/tree/master/charsets): `charsets`

### Hash computation

- [Hashing engine](https://github.com/hashcat/hashcat-legacy/blob/master/src/engine.c): `src/engine.c`
- [Hash algorithms](https://github.com/hashcat/hashcat-legacy/blob/master/src/engine.c): `src/engine.c`
- [Digest comparison](https://github.com/hashcat/hashcat-legacy/blob/master/src/hashcat-cli.c): `src/hashcat-cli.c`

### Results and state

- **Recovered passwords**
- **Recovery state**

### Other components

- **Operator**
- **Target hashes**

## Connections

- Operator → CLI and orchestration: invokes
- Target hashes → Hash loading and indexing: supplies hashes
- CLI and orchestration → Hash loading and indexing: loads targets
- CLI and orchestration → Attack modes: selects attack
- Word candidates → Attack modes: provides candidates
- Rule collections → Rule transformations: provides rules
- Mask patterns → Attack modes: provides patterns
- Charset definitions → Attack modes: provides characters
- Attack modes → Rule transformations: applies transforms
- CLI and orchestration → Hashing engine: dispatches work
- Hashing engine → Hash algorithms: computes digests
- Hashing engine → Digest comparison: submits digests
- Hash loading and indexing → Digest comparison: supplies targets
- Digest comparison → CLI and orchestration: reports matches
- CLI and orchestration → Recovered passwords: emits plaintexts
- CLI and orchestration → Recovery state: records recovery state
