# alvinto27/inf2005-acw1 architecture

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

- Interactive diagram: https://gitdiagram.com/alvinto27/inf2005-acw1
- Repository: https://github.com/alvinto27/inf2005-acw1

## Overview

This is a localhost Flask app and Python library for protocol-v3 media steganography. The main workflow accepts a cover, payload, and sender/receiver keys; converts supported non-strict sources to canonical media; embeds an encrypted, signed payload and receiver bootstrap; then verifies and recovers the payload. The graph includes PNG/WAV and video carriers, protocol primitives, and the web adapter. Relationships are limited to README-documented flows and source references in the supplied index; unsampled internals are not inferred.

Main entry points: [`stego/core.py`](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/core.py) (Encode and verify), [`stego_web/routes.py`](https://github.com/alvinto27/inf2005-acw1/blob/main/stego_web/routes.py) (Flask routes), [`stego_web/services/current_protocol.py`](https://github.com/alvinto27/inf2005-acw1/blob/main/stego_web/services/current_protocol.py) (Web protocol adapter), [`stego/bits.py`](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/bits.py) (LSB bit operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_browser["Browser interface<br/>[app.js]"]
  node_web_routes["Flask routes<br/>[routes.py]"]
  node_web_protocol["Web protocol adapter"]
end

subgraph group_sources["Source preparation"]
  node_source_conversion["Image/audio conversion<br/>[sources.py]"]
end

subgraph group_protocol["Protocol engine"]
  node_protocol_core["Encode and verify<br/>[core.py]"]
  node_packet_records["Payload records<br/>[packet.py]"]
  node_crypto["Cryptography<br/>[crypto.py]"]
  node_bootstrap["Receiver bootstrap<br/>[bootstrap.py]"]
  node_layout_hash["Layout and media hash<br/>[layout.py]"]
  node_bit_ops["LSB bit operations<br/>[bits.py]"]
end

subgraph group_carriers["Carrier backends"]
  node_video_backend["Video carrier<br/>[video.py]"]
  node_carrier_access["Carrier access<br/>[carrier.py]"]
  node_png_backend["PNG backend<br/>[media.py]"]
  node_wav_backend["WAV backend<br/>[media.py]"]
end

node_user(("Local user"))
node_video_source(("Video source input"))
node_image_audio_source(("Image/audio source input"))
node_keys_payload(("Keys and payload"))

node_user -->|"uses"| node_browser
node_browser -->|"sends requests"| node_web_routes
node_web_routes -->|"delegates to"| node_web_protocol
node_web_routes -->|"calls API"| node_protocol_core
node_image_audio_source -->|"uploads cover"| node_web_routes
node_video_source -->|"uploads cover"| node_web_routes
node_keys_payload -->|"provides inputs"| node_web_routes
node_web_protocol -->|"converts sources"| node_source_conversion
node_web_protocol -->|"builds metadata"| node_packet_records
node_web_protocol -->|"uses key functions"| node_crypto
node_source_conversion -->|"prepares carriers"| node_protocol_core
node_source_conversion -->|"uses video carrier"| node_video_backend
node_protocol_core -->|"encodes bootstrap"| node_bootstrap
node_protocol_core -->|"serializes records"| node_packet_records
node_protocol_core -->|"encrypts and signs"| node_crypto
node_protocol_core -->|"builds layout"| node_layout_hash
node_protocol_core -->|"reads and rewrites"| node_carrier_access
node_protocol_core -->|"opens PNG media"| node_png_backend
node_protocol_core -->|"opens WAV media"| node_wav_backend
node_protocol_core -->|"supports video"| node_video_backend
node_layout_hash -->|"uses carrier ranges"| node_carrier_access
node_layout_hash -->|"uses bit helpers"| node_bit_ops
node_carrier_access -->|"transforms LSBs"| node_bit_ops
node_png_backend -->|"uses bit helpers"| node_bit_ops
node_wav_backend -->|"uses bit helpers"| node_bit_ops

click node_browser "https://github.com/alvinto27/inf2005-acw1/blob/main/stego_web/static/app.js"
click node_web_routes "https://github.com/alvinto27/inf2005-acw1/blob/main/stego_web/routes.py"
click node_web_protocol "https://github.com/alvinto27/inf2005-acw1/blob/main/stego_web/services/current_protocol.py"
click node_source_conversion "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/sources.py"
click node_video_backend "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/video.py"
click node_protocol_core "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/core.py"
click node_packet_records "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/packet.py"
click node_crypto "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/crypto.py"
click node_bootstrap "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/bootstrap.py"
click node_layout_hash "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/layout.py"
click node_bit_ops "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/bits.py"
click node_carrier_access "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/carrier.py"
click node_png_backend "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/media.py"
click node_wav_backend "https://github.com/alvinto27/inf2005-acw1/blob/main/stego/media.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_browser,node_web_routes,node_web_protocol,node_user toneBlue
class node_source_conversion toneAmber
class node_protocol_core,node_packet_records,node_crypto,node_bootstrap,node_layout_hash,node_bit_ops toneMint
class node_video_backend,node_carrier_access,node_png_backend,node_wav_backend toneRose
class node_video_source,node_image_audio_source,node_keys_payload toneIndigo
```

## Components

### Web application

- [Browser interface](https://github.com/alvinto27/inf2005-acw1/blob/main/stego_web/static/app.js): `stego_web/static/app.js`
- [Flask routes](https://github.com/alvinto27/inf2005-acw1/blob/main/stego_web/routes.py): `stego_web/routes.py`
- [Web protocol adapter](https://github.com/alvinto27/inf2005-acw1/blob/main/stego_web/services/current_protocol.py): `stego_web/services/current_protocol.py`

### Source preparation

- [Image/audio conversion](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/sources.py): `stego/sources.py`

### Protocol engine

- [Encode and verify](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/core.py): `stego/core.py`
- [Payload records](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/packet.py): `stego/packet.py`
- [Cryptography](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/crypto.py): `stego/crypto.py`
- [Receiver bootstrap](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/bootstrap.py): `stego/bootstrap.py`
- [Layout and media hash](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/layout.py): `stego/layout.py`
- [LSB bit operations](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/bits.py): `stego/bits.py`

### Carrier backends

- [Video carrier](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/video.py): `stego/video.py`
- [Carrier access](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/carrier.py): `stego/carrier.py`
- [PNG backend](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/media.py): `stego/media.py`
- [WAV backend](https://github.com/alvinto27/inf2005-acw1/blob/main/stego/media.py): `stego/media.py`

### Other components

- **Local user**
- **Video source input**
- **Image/audio source input**
- **Keys and payload**

## Connections

- Local user → Browser interface: uses (evidence: `README.md`)
- Browser interface → Flask routes: sends requests (evidence: `README.md`)
- Flask routes → Web protocol adapter: delegates to (evidence: `stego_web/routes.py`)
- Flask routes → Encode and verify: calls API (evidence: `stego_web/routes.py`)
- Image/audio source input → Flask routes: uploads cover (evidence: `README.md`)
- Video source input → Flask routes: uploads cover (evidence: `README.md`)
- Keys and payload → Flask routes: provides inputs (evidence: `README.md`)
- Web protocol adapter → Image/audio conversion: converts sources (evidence: `stego_web/services/current_protocol.py`)
- Web protocol adapter → Payload records: builds metadata (evidence: `stego_web/services/current_protocol.py`)
- Web protocol adapter → Cryptography: uses key functions (evidence: `stego_web/services/current_protocol.py`)
- Image/audio conversion → Encode and verify: prepares carriers (evidence: `stego/sources.py`)
- Image/audio conversion → Video carrier: uses video carrier (evidence: `stego/sources.py`)
- Encode and verify → Receiver bootstrap: encodes bootstrap (evidence: `stego/core.py`)
- Encode and verify → Payload records: serializes records (evidence: `stego/core.py`)
- Encode and verify → Cryptography: encrypts and signs (evidence: `stego/core.py`)
- Encode and verify → Layout and media hash: builds layout (evidence: `stego/core.py`)
- Encode and verify → Carrier access: reads and rewrites (evidence: `stego/core.py`)
- Encode and verify → PNG backend: opens PNG media (evidence: `stego/core.py`)
- Encode and verify → WAV backend: opens WAV media (evidence: `stego/core.py`)
- Encode and verify → Video carrier: supports video (evidence: `stego/video.py`)
- Layout and media hash → Carrier access: uses carrier ranges (evidence: `stego/layout.py`)
- Layout and media hash → LSB bit operations: uses bit helpers (evidence: `stego/layout.py`)
- Carrier access → LSB bit operations: transforms LSBs (evidence: `stego/carrier.py`)
- PNG backend → LSB bit operations: uses bit helpers (evidence: `stego/media.py`)
- WAV backend → LSB bit operations: uses bit helpers (evidence: `stego/media.py`)
