# simeuda/file_encryption_program architecture

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

- Interactive diagram: https://gitdiagram.com/simeuda/file_encryption_program
- Repository: https://github.com/simeuda/file_encryption_program

## Overview

This is a C++ command-line file encryption program. The user selects a file, algorithm, key and block mode; the program streams the file through the chosen mode and replaces it with the transformed output. DES and Triple DES are the implemented ciphers, and the menu hashes text or file input to derive keys using HES. The README also describes parallel processing, but says it is not yet implemented; the queue is not active in the sampled workflow. Links reflect shown calls or documented capabilities; unsampled implementation details are left unconnected.

Main entry points: [`main.cpp`](https://github.com/simeuda/file_encryption_program/blob/main/main.cpp) (CLI workflow), [`src/cryptologic/mode/mode.cpp`](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/mode.cpp) (Mode base), [`src/cryptologic/DES/DES.cpp`](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/DES/DES.cpp) (DES), [`include/cryptologic/crypto.h`](https://github.com/simeuda/file_encryption_program/blob/main/include/cryptologic/crypto.h) (Cipher interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Application workflow"]
  node_cli["CLI workflow<br/>[main.cpp]"]
  node_file_stream["File streaming<br/>[main.cpp]"]
  node_menu["Menu and key input<br/>[menu.cpp]"]
end

subgraph group_cipher["Cipher implementations"]
  node_crypto_api["Cipher interface<br/>[crypto.h]"]
  node_des["DES<br/>[DES.cpp]"]
  node_feistel["Feistel rounds<br/>[feistel.cpp]"]
  node_triple_des["Triple DES<br/>[Triple_DES.cpp]"]
end

subgraph group_modes["Block modes"]
  node_mode_base["Mode base<br/>[mode.cpp]"]
  node_ecb["ECB<br/>[ECB.cpp]"]
  node_cbc["CBC<br/>[CBC.cpp]"]
  node_cfb["CFB<br/>[CFB.cpp]"]
  node_ofb["OFB<br/>[OFB.cpp]"]
  node_ctr["CTR<br/>[CTR.cpp]"]
end

subgraph group_hashing["Key hashing"]
  node_hash_api["Hash interface<br/>[HASH.h]"]
  node_hash_engine["Hash engine<br/>[HASH.cpp]"]
  node_hes["HES<br/>[HES.cpp]"]
end

node_user(("User"))

node_user -->|"selects workflow"| node_cli
node_cli -->|"requests choices"| node_menu
node_menu -->|"hashes key input"| node_hes
node_hes -->|"implements"| node_hash_api
node_cli -->|"streams file"| node_file_stream
node_cli -->|"dispatches"| node_ecb
node_cli -->|"dispatches"| node_cbc
node_cli -->|"dispatches"| node_cfb
node_cli -->|"dispatches"| node_ofb
node_cli -->|"dispatches"| node_ctr
node_des -->|"implements"| node_crypto_api
node_triple_des -->|"implements"| node_crypto_api
node_des -->|"inherits rounds"| node_feistel
node_triple_des -->|"uses DES objects"| node_des
node_hash_engine -->|"implements"| node_hash_api
node_hash_engine -.->|"uses cipher"| node_des
node_mode_base -->|"holds cipher"| node_crypto_api
node_ecb -->|"extends base"| node_mode_base
node_cbc -->|"extends base"| node_mode_base
node_cfb -->|"extends base"| node_mode_base
node_ofb -->|"extends base"| node_mode_base
node_ctr -->|"extends base"| node_mode_base

click node_cli "https://github.com/simeuda/file_encryption_program/blob/main/main.cpp"
click node_file_stream "https://github.com/simeuda/file_encryption_program/blob/main/main.cpp"
click node_menu "https://github.com/simeuda/file_encryption_program/blob/main/src/interface/menu.cpp"
click node_crypto_api "https://github.com/simeuda/file_encryption_program/blob/main/include/cryptologic/crypto.h"
click node_des "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/DES/DES.cpp"
click node_feistel "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/DES/feistel.cpp"
click node_triple_des "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/DES/Triple_DES.cpp"
click node_hash_api "https://github.com/simeuda/file_encryption_program/blob/main/include/cryptologic/HASH/HASH.h"
click node_hash_engine "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/HASH/HASH.cpp"
click node_hes "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/HASH/HES/HES.cpp"
click node_mode_base "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/mode.cpp"
click node_ecb "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/op_mode/ECB.cpp"
click node_cbc "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/op_mode/CBC.cpp"
click node_cfb "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/op_mode/CFB.cpp"
click node_ofb "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/op_mode/OFB.cpp"
click node_ctr "https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/op_mode/CTR.cpp"

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_file_stream,node_menu,node_user toneBlue
class node_crypto_api,node_des,node_feistel,node_triple_des toneAmber
class node_mode_base,node_ecb,node_cbc,node_cfb,node_ofb,node_ctr toneMint
class node_hash_api,node_hash_engine,node_hes toneRose
```

## Components

### Application workflow

- [CLI workflow](https://github.com/simeuda/file_encryption_program/blob/main/main.cpp): `main.cpp`
- [File streaming](https://github.com/simeuda/file_encryption_program/blob/main/main.cpp): `main.cpp`
- [Menu and key input](https://github.com/simeuda/file_encryption_program/blob/main/src/interface/menu.cpp): `src/interface/menu.cpp`

### Cipher implementations

- [Cipher interface](https://github.com/simeuda/file_encryption_program/blob/main/include/cryptologic/crypto.h): `include/cryptologic/crypto.h`
- [DES](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/DES/DES.cpp): `src/cryptologic/DES/DES.cpp`
- [Feistel rounds](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/DES/feistel.cpp): `src/cryptologic/DES/feistel.cpp`
- [Triple DES](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/DES/Triple_DES.cpp): `src/cryptologic/DES/Triple_DES.cpp`

### Block modes

- [Mode base](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/mode.cpp): `src/cryptologic/mode/mode.cpp`
- [ECB](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/op_mode/ECB.cpp): `src/cryptologic/mode/op_mode/ECB.cpp`
- [CBC](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/op_mode/CBC.cpp): `src/cryptologic/mode/op_mode/CBC.cpp`
- [CFB](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/op_mode/CFB.cpp): `src/cryptologic/mode/op_mode/CFB.cpp`
- [OFB](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/op_mode/OFB.cpp): `src/cryptologic/mode/op_mode/OFB.cpp`
- [CTR](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/mode/op_mode/CTR.cpp): `src/cryptologic/mode/op_mode/CTR.cpp`

### Key hashing

- [Hash interface](https://github.com/simeuda/file_encryption_program/blob/main/include/cryptologic/HASH/HASH.h): `include/cryptologic/HASH/HASH.h`
- [Hash engine](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/HASH/HASH.cpp): `src/cryptologic/HASH/HASH.cpp`
- [HES](https://github.com/simeuda/file_encryption_program/blob/main/src/cryptologic/HASH/HES/HES.cpp): `src/cryptologic/HASH/HES/HES.cpp`

### Other components

- **User**

## Connections

- User → CLI workflow: selects workflow (evidence: `README.md`)
- CLI workflow → Menu and key input: requests choices (evidence: `main.cpp`)
- Menu and key input → HES: hashes key input (evidence: `src/interface/menu.cpp`)
- HES → Hash interface: implements
- CLI workflow → File streaming: streams file (evidence: `main.cpp`)
- CLI workflow → ECB: dispatches (evidence: `main.cpp`)
- CLI workflow → CBC: dispatches (evidence: `main.cpp`)
- CLI workflow → CFB: dispatches (evidence: `main.cpp`)
- CLI workflow → OFB: dispatches (evidence: `main.cpp`)
- CLI workflow → CTR: dispatches (evidence: `main.cpp`)
- DES → Cipher interface: implements (evidence: `src/cryptologic/DES/DES.cpp`)
- Triple DES → Cipher interface: implements
- DES → Feistel rounds: inherits rounds
- Triple DES → DES: uses DES objects (evidence: `src/cryptologic/DES/Triple_DES.cpp`)
- Hash engine → Hash interface: implements (evidence: `src/cryptologic/HASH/HASH.cpp`)
- Hash engine → DES: uses cipher
- Mode base → Cipher interface: holds cipher
- ECB → Mode base: extends base
- CBC → Mode base: extends base
- CFB → Mode base: extends base
- OFB → Mode base: extends base
- CTR → Mode base: extends base
