# hdim2355/kriptografia architecture

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

- Interactive diagram: https://gitdiagram.com/hdim2355/kriptografia
- Repository: https://github.com/hdim2355/kriptografia

## Overview

This repository contains three cryptography exercises: classical cipher routines, configurable block encryption for files/data, and a networked peer-messaging exercise. The main user-to-result flow is lab2's driver passing bytes through Crypter for padding, mode selection, and encryption/decryption. The lab1 and lab3 capabilities are separate product branches. Relationships below are limited to the shown excerpts and SOURCE INDEX references; unsampled behavior is not inferred.

Main entry points: [`lab2/Crypter.py`](https://github.com/hdim2355/kriptografia/blob/main/lab2/Crypter.py) (Crypter), [`lab3/client.py`](https://github.com/hdim2355/kriptografia/blob/main/lab3/client.py) (Messaging Client), [`lab1/assign1/crypto-console.py`](https://github.com/hdim2355/kriptografia/blob/main/lab1/assign1/crypto-console.py) (Cipher Console), [`lab1/assign1/crypto.py`](https://github.com/hdim2355/kriptografia/blob/main/lab1/assign1/crypto.py) (Classical Ciphers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_classical["Classical Ciphers"]
  node_classic_cli["Cipher Console<br/>[crypto-console.py]"]
  node_classic_ciphers["Classical Ciphers<br/>[crypto.py]"]
  node_classic_utils["Cipher Utilities<br/>[utils.py]"]
  node_caesar_program["Caesar Program<br/>[cezar.py]"]
end

subgraph group_block["Block Encryption"]
  node_block_driver["File Encryption Driver<br/>[main.py]"]
  node_block_crypter["Crypter<br/>[Crypter.py]"]
  node_padding["Padding<br/>[Padding.py]"]
  node_aes["AES Cipher<br/>[AES.py]"]
  node_own_algorithm["Custom Cipher<br/>[OwnAlg.py]"]
  node_ecb["ECB Mode<br/>[ECB.py]"]
  node_cbc["CBC Mode<br/>[CBC.py]"]
  node_cfb["CFB Mode<br/>[CFB.py]"]
  node_ofb["OFB Mode<br/>[OFB.py]"]
  node_ctr["CTR Mode<br/>[CTR.py]"]
end

subgraph group_messaging["Secure Messaging"]
  node_message_client["Messaging Client<br/>[client.py]"]
  node_sender["Message Sender<br/>[MessageSender.py]"]
  node_receiver["Message Receiver<br/>[MessageReceiver.py]"]
  node_messaging_crypter["Messaging Crypter<br/>[Crypter.py]"]
  node_messaging_aes["Messaging AES<br/>[AES.py]"]
  node_messaging_custom["Messaging Custom Cipher<br/>[OwnAlg.py]"]
  node_messaging_padding["Messaging Padding<br/>[Padding.py]"]
  node_keyserver["Key Server<br/>[keyserver.py]"]
end

node_user(("User"))
node_peer(("Peer Client"))

node_user -->|"runs"| node_classic_cli
node_classic_cli -->|"calls"| node_classic_ciphers
node_classic_ciphers -->|"uses"| node_classic_utils
node_user -.->|"runs"| node_caesar_program
node_user -->|"runs"| node_block_driver
node_block_driver -->|"encrypts data"| node_block_crypter
node_block_crypter -->|"pads data"| node_padding
node_block_crypter -->|"dispatches AES"| node_aes
node_block_crypter -->|"dispatches custom"| node_own_algorithm
node_block_crypter -->|"selects mode"| node_ecb
node_block_crypter -->|"selects mode"| node_cbc
node_block_crypter -->|"selects mode"| node_cfb
node_block_crypter -->|"selects mode"| node_ofb
node_block_crypter -->|"selects mode"| node_ctr
node_user -.->|"starts client"| node_message_client
node_message_client -->|"delegates sending"| node_sender
node_message_client -->|"delegates receiving"| node_receiver
node_message_client -->|"uses encryption"| node_block_crypter
node_message_client -->|"requests keys"| node_keyserver
node_message_client -->|"exchanges messages"| node_peer

click node_classic_cli "https://github.com/hdim2355/kriptografia/blob/main/lab1/assign1/crypto-console.py"
click node_classic_ciphers "https://github.com/hdim2355/kriptografia/blob/main/lab1/assign1/crypto.py"
click node_classic_utils "https://github.com/hdim2355/kriptografia/blob/main/lab1/assign1/utils.py"
click node_caesar_program "https://github.com/hdim2355/kriptografia/blob/main/lab1/cezar.py"
click node_block_driver "https://github.com/hdim2355/kriptografia/blob/main/lab2/main.py"
click node_block_crypter "https://github.com/hdim2355/kriptografia/blob/main/lab2/Crypter.py"
click node_padding "https://github.com/hdim2355/kriptografia/blob/main/lab2/Padding.py"
click node_aes "https://github.com/hdim2355/kriptografia/blob/main/lab2/AES.py"
click node_own_algorithm "https://github.com/hdim2355/kriptografia/blob/main/lab2/OwnAlg.py"
click node_ecb "https://github.com/hdim2355/kriptografia/blob/main/lab2/methods/ECB.py"
click node_cbc "https://github.com/hdim2355/kriptografia/blob/main/lab2/methods/CBC.py"
click node_cfb "https://github.com/hdim2355/kriptografia/blob/main/lab2/methods/CFB.py"
click node_ofb "https://github.com/hdim2355/kriptografia/blob/main/lab2/methods/OFB.py"
click node_ctr "https://github.com/hdim2355/kriptografia/blob/main/lab2/methods/CTR.py"
click node_message_client "https://github.com/hdim2355/kriptografia/blob/main/lab3/client.py"
click node_sender "https://github.com/hdim2355/kriptografia/blob/main/lab3/MessageSender.py"
click node_receiver "https://github.com/hdim2355/kriptografia/blob/main/lab3/MessageReceiver.py"
click node_messaging_crypter "https://github.com/hdim2355/kriptografia/blob/main/lab3/Crypter.py"
click node_messaging_aes "https://github.com/hdim2355/kriptografia/blob/main/lab3/AES.py"
click node_messaging_custom "https://github.com/hdim2355/kriptografia/blob/main/lab3/OwnAlg.py"
click node_messaging_padding "https://github.com/hdim2355/kriptografia/blob/main/lab3/Padding.py"
click node_keyserver "https://github.com/hdim2355/kriptografia/blob/main/lab3/keyserver.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_classic_cli,node_classic_ciphers,node_classic_utils,node_caesar_program,node_user,node_peer toneBlue
class node_block_driver,node_block_crypter,node_padding,node_aes,node_own_algorithm,node_ecb,node_cbc,node_cfb,node_ofb,node_ctr toneAmber
class node_message_client,node_sender,node_receiver,node_messaging_crypter,node_messaging_aes,node_messaging_custom,node_messaging_padding,node_keyserver toneMint
```

## Components

### Classical Ciphers

- [Cipher Console](https://github.com/hdim2355/kriptografia/blob/main/lab1/assign1/crypto-console.py): `lab1/assign1/crypto-console.py`
- [Classical Ciphers](https://github.com/hdim2355/kriptografia/blob/main/lab1/assign1/crypto.py): `lab1/assign1/crypto.py`
- [Cipher Utilities](https://github.com/hdim2355/kriptografia/blob/main/lab1/assign1/utils.py): `lab1/assign1/utils.py`
- [Caesar Program](https://github.com/hdim2355/kriptografia/blob/main/lab1/cezar.py): `lab1/cezar.py`

### Block Encryption

- [File Encryption Driver](https://github.com/hdim2355/kriptografia/blob/main/lab2/main.py): `lab2/main.py`
- [Crypter](https://github.com/hdim2355/kriptografia/blob/main/lab2/Crypter.py): `lab2/Crypter.py`
- [Padding](https://github.com/hdim2355/kriptografia/blob/main/lab2/Padding.py): `lab2/Padding.py`
- [AES Cipher](https://github.com/hdim2355/kriptografia/blob/main/lab2/AES.py): `lab2/AES.py`
- [Custom Cipher](https://github.com/hdim2355/kriptografia/blob/main/lab2/OwnAlg.py): `lab2/OwnAlg.py`
- [ECB Mode](https://github.com/hdim2355/kriptografia/blob/main/lab2/methods/ECB.py): `lab2/methods/ECB.py`
- [CBC Mode](https://github.com/hdim2355/kriptografia/blob/main/lab2/methods/CBC.py): `lab2/methods/CBC.py`
- [CFB Mode](https://github.com/hdim2355/kriptografia/blob/main/lab2/methods/CFB.py): `lab2/methods/CFB.py`
- [OFB Mode](https://github.com/hdim2355/kriptografia/blob/main/lab2/methods/OFB.py): `lab2/methods/OFB.py`
- [CTR Mode](https://github.com/hdim2355/kriptografia/blob/main/lab2/methods/CTR.py): `lab2/methods/CTR.py`

### Secure Messaging

- [Messaging Client](https://github.com/hdim2355/kriptografia/blob/main/lab3/client.py): `lab3/client.py`
- [Message Sender](https://github.com/hdim2355/kriptografia/blob/main/lab3/MessageSender.py): `lab3/MessageSender.py`
- [Message Receiver](https://github.com/hdim2355/kriptografia/blob/main/lab3/MessageReceiver.py): `lab3/MessageReceiver.py`
- [Messaging Crypter](https://github.com/hdim2355/kriptografia/blob/main/lab3/Crypter.py): `lab3/Crypter.py`
- [Messaging AES](https://github.com/hdim2355/kriptografia/blob/main/lab3/AES.py): `lab3/AES.py`
- [Messaging Custom Cipher](https://github.com/hdim2355/kriptografia/blob/main/lab3/OwnAlg.py): `lab3/OwnAlg.py`
- [Messaging Padding](https://github.com/hdim2355/kriptografia/blob/main/lab3/Padding.py): `lab3/Padding.py`
- [Key Server](https://github.com/hdim2355/kriptografia/blob/main/lab3/keyserver.py): `lab3/keyserver.py`

### Other components

- **User**
- **Peer Client**

## Connections

- User → Cipher Console: runs (evidence: `lab1/assign1/crypto-console.py`)
- Cipher Console → Classical Ciphers: calls (evidence: `lab1/assign1/crypto-console.py`)
- Classical Ciphers → Cipher Utilities: uses (evidence: `lab1/assign1/crypto.py`)
- User → Caesar Program: runs
- User → File Encryption Driver: runs (evidence: `lab2/main.py`)
- File Encryption Driver → Crypter: encrypts data (evidence: `lab2/main.py`)
- Crypter → Padding: pads data (evidence: `lab2/Crypter.py`)
- Crypter → AES Cipher: dispatches AES (evidence: `lab2/Crypter.py`)
- Crypter → Custom Cipher: dispatches custom (evidence: `lab2/Crypter.py`)
- Crypter → ECB Mode: selects mode (evidence: `lab2/Crypter.py`)
- Crypter → CBC Mode: selects mode (evidence: `lab2/Crypter.py`)
- Crypter → CFB Mode: selects mode (evidence: `lab2/Crypter.py`)
- Crypter → OFB Mode: selects mode (evidence: `lab2/Crypter.py`)
- Crypter → CTR Mode: selects mode (evidence: `lab2/Crypter.py`)
- User → Messaging Client: starts client
- Messaging Client → Message Sender: delegates sending (evidence: `lab3/client.py`)
- Messaging Client → Message Receiver: delegates receiving (evidence: `lab3/client.py`)
- Messaging Client → Crypter: uses encryption (evidence: `lab3/client.py`)
- Messaging Client → Key Server: requests keys (evidence: `lab3/client.py`)
- Messaging Client → Peer Client: exchanges messages (evidence: `lab3/client.py`)
