# delta203/hashfunction architecture

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

- Interactive diagram: https://gitdiagram.com/delta203/hashfunction
- Repository: https://github.com/delta203/hashfunction

## Overview

Hashfunction is a small Python hashing tool: users can hash a string directly or use the command-line modes to generate hash files and check for duplicate hashes. The core algorithm and CLI are in the two sampled source files. The README documents the algorithm stages and CLI capabilities; relationships for those workflows are based on the sampled launcher and hash implementation.

Main entry points: [`hashfunction.py`](https://github.com/delta203/hashfunction/blob/main/hashfunction.py) (Hash API), [`launcher.py`](https://github.com/delta203/hashfunction/blob/main/launcher.py) (CLI dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_launcher["CLI dispatcher<br/>[launcher.py]"]
  node_direct["Direct hash<br/>[launcher.py]"]
  node_fetch["List hashing<br/>[launcher.py]"]
  node_range["Range hashing<br/>[launcher.py]"]
  node_chain["Hash chaining<br/>[launcher.py]"]
  node_collision["Collision check<br/>[launcher.py]"]
end

subgraph group_hash["Hash algorithm"]
  node_hashclass["Hash API<br/>[hashfunction.py]"]
  node_prepare["Bit preparation<br/>[hashfunction.py]"]
  node_blocks["Block splitting<br/>[hashfunction.py]"]
  node_modulus["Modulus blocks<br/>[hashfunction.py]"]
  node_combine["XOR combination<br/>[hashfunction.py]"]
  node_compress["Bit compression<br/>[hashfunction.py]"]
  node_hex["Hex conversion<br/>[hashfunction.py]"]
end

subgraph group_files["File operations"]
  node_sourcefile["Input file"]
  node_targetfile["Hash file"]
  node_collisionfile["Hashes to check"]
end

node_user(("User"))

node_user -->|"runs command"| node_launcher
node_launcher -->|"dispatches"| node_direct
node_launcher -->|"dispatches"| node_fetch
node_launcher -->|"dispatches"| node_range
node_launcher -->|"dispatches"| node_chain
node_launcher -->|"dispatches"| node_collision
node_direct -->|"hashes input"| node_hashclass
node_fetch -->|"reads words"| node_sourcefile
node_fetch -->|"hashes words"| node_hashclass
node_fetch -->|"appends hashes"| node_targetfile
node_range -->|"hashes strings"| node_hashclass
node_range -->|"appends hashes"| node_targetfile
node_chain -->|"rehashes output"| node_hashclass
node_chain -->|"appends hashes"| node_targetfile
node_collision -->|"reads hashes"| node_collisionfile
node_direct -->|"requests hash"| node_hashclass
node_hashclass -->|"calls"| node_prepare
node_prepare -->|"prepares bits"| node_blocks
node_blocks -->|"derives blocks"| node_modulus
node_blocks -->|"provides blocks"| node_combine
node_modulus -->|"provides modulus blocks"| node_combine
node_combine -->|"reduces bits"| node_compress
node_compress -->|"converts result"| node_hex
node_hex -->|"returns hash"| node_hashclass

click node_launcher "https://github.com/delta203/hashfunction/blob/main/launcher.py"
click node_direct "https://github.com/delta203/hashfunction/blob/main/launcher.py"
click node_fetch "https://github.com/delta203/hashfunction/blob/main/launcher.py"
click node_range "https://github.com/delta203/hashfunction/blob/main/launcher.py"
click node_chain "https://github.com/delta203/hashfunction/blob/main/launcher.py"
click node_collision "https://github.com/delta203/hashfunction/blob/main/launcher.py"
click node_hashclass "https://github.com/delta203/hashfunction/blob/main/hashfunction.py"
click node_prepare "https://github.com/delta203/hashfunction/blob/main/hashfunction.py"
click node_blocks "https://github.com/delta203/hashfunction/blob/main/hashfunction.py"
click node_modulus "https://github.com/delta203/hashfunction/blob/main/hashfunction.py"
click node_combine "https://github.com/delta203/hashfunction/blob/main/hashfunction.py"
click node_compress "https://github.com/delta203/hashfunction/blob/main/hashfunction.py"
click node_hex "https://github.com/delta203/hashfunction/blob/main/hashfunction.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_launcher,node_direct,node_fetch,node_range,node_chain,node_collision,node_user toneBlue
class node_hashclass,node_prepare,node_blocks,node_modulus,node_combine,node_compress,node_hex toneAmber
class node_sourcefile,node_targetfile,node_collisionfile toneMint
```

## Components

### CLI workflows

- [CLI dispatcher](https://github.com/delta203/hashfunction/blob/main/launcher.py): `launcher.py`
- [Direct hash](https://github.com/delta203/hashfunction/blob/main/launcher.py): `launcher.py`
- [List hashing](https://github.com/delta203/hashfunction/blob/main/launcher.py): `launcher.py`
- [Range hashing](https://github.com/delta203/hashfunction/blob/main/launcher.py): `launcher.py`
- [Hash chaining](https://github.com/delta203/hashfunction/blob/main/launcher.py): `launcher.py`
- [Collision check](https://github.com/delta203/hashfunction/blob/main/launcher.py): `launcher.py`

### Hash algorithm

- [Hash API](https://github.com/delta203/hashfunction/blob/main/hashfunction.py): `hashfunction.py`
- [Bit preparation](https://github.com/delta203/hashfunction/blob/main/hashfunction.py): `hashfunction.py`
- [Block splitting](https://github.com/delta203/hashfunction/blob/main/hashfunction.py): `hashfunction.py`
- [Modulus blocks](https://github.com/delta203/hashfunction/blob/main/hashfunction.py): `hashfunction.py`
- [XOR combination](https://github.com/delta203/hashfunction/blob/main/hashfunction.py): `hashfunction.py`
- [Bit compression](https://github.com/delta203/hashfunction/blob/main/hashfunction.py): `hashfunction.py`
- [Hex conversion](https://github.com/delta203/hashfunction/blob/main/hashfunction.py): `hashfunction.py`

### File operations

- **Input file**
- **Hash file**
- **Hashes to check**

### Other components

- **User**

## Connections

- User → CLI dispatcher: runs command
- CLI dispatcher → Direct hash: dispatches
- CLI dispatcher → List hashing: dispatches
- CLI dispatcher → Range hashing: dispatches
- CLI dispatcher → Hash chaining: dispatches
- CLI dispatcher → Collision check: dispatches
- Direct hash → Hash API: hashes input
- List hashing → Input file: reads words
- List hashing → Hash API: hashes words
- List hashing → Hash file: appends hashes
- Range hashing → Hash API: hashes strings
- Range hashing → Hash file: appends hashes
- Hash chaining → Hash API: rehashes output
- Hash chaining → Hash file: appends hashes
- Collision check → Hashes to check: reads hashes
- Direct hash → Hash API: requests hash
- Hash API → Bit preparation: calls
- Bit preparation → Block splitting: prepares bits
- Block splitting → Modulus blocks: derives blocks
- Block splitting → XOR combination: provides blocks
- Modulus blocks → XOR combination: provides modulus blocks
- XOR combination → Bit compression: reduces bits
- Bit compression → Hex conversion: converts result
- Hex conversion → Hash API: returns hash
