# hawike22405/lorenz-blake3-cipher architecture

> Architecture diagram of the GitHub repository hawike22405/lorenz-blake3-cipher, 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/hawike22405/lorenz-blake3-cipher
- Repository: https://github.com/hawike22405/lorenz-blake3-cipher

## Overview

This research prototype offers two distinct file-encryption workflows: the Rust `lrz` CLI encrypts, decrypts, or verifies raw image-byte containers, while a separate Python tool protects whole files with AES-256-GCM. Image conversion and evaluation scripts support the cipher workflow; separate tools analyze image statistics, prepare NIST test streams, and demonstrate a toy equivalent-key attack. The excerpts show CLI dispatch and script invocations, but do not expose all cipher internals or the evaluation runner, so those are represented at subsystem level.

Main entry points: [`code/src/main.rs`](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/code/src/main.rs) (LRZ CLI), [`scripts/image_demo.py`](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/image_demo.py) (Image Adapter), [`scripts/image_metrics.py`](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/image_metrics.py) (Image Metrics), [`scripts/make_nist_bits.py`](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/make_nist_bits.py) (NIST Prep)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_image["Image Cipher"]
  node_image_demo["Image Adapter<br/>[image_demo.py]"]
  node_lrz_cli["LRZ CLI<br/>[main.rs]"]
  node_cipher["Cipher Engine<br/>[cipher.rs]"]
  node_image_files["Image Files"]
end

subgraph group_aead["AES File Tool"]
  node_aead_tool["AES-GCM Tool<br/>[aead_file.py]"]
  node_whole_files["Whole Files"]
end

subgraph group_evaluation["Evaluation"]
  node_metrics["Image Metrics<br/>[image_metrics.py]"]
  node_nist_prep["NIST Prep<br/>[make_nist_bits.py]"]
  node_nist_suite["NIST Suite"]
end

subgraph group_analysis["Analysis"]
  node_stats["Image Statistics<br/>[stats.py]"]
end

subgraph group_research["Research Demo"]
  node_toy_attack["Toy Key Attack"]
end

node_user(("User"))

node_user -->|"selects image"| node_image_demo
node_image_demo -->|"reads and writes"| node_image_files
node_image_demo -->|"invokes"| node_lrz_cli
node_user -->|"runs commands"| node_lrz_cli
node_lrz_cli -->|"encrypts, decrypts, verifies"| node_cipher
node_lrz_cli -->|"reads and writes"| node_image_files
node_user -->|"requests operation"| node_aead_tool
node_aead_tool -->|"reads and writes"| node_whole_files
node_user -->|"runs evaluation"| node_metrics
node_metrics -->|"invokes encryption and decryption"| node_lrz_cli
node_user -->|"requests statistics"| node_stats
node_metrics -->|"uses statistics"| node_stats
node_user -->|"prepares bitstreams"| node_nist_prep
node_nist_prep -->|"reads containers"| node_image_files
node_user -->|"runs tests"| node_nist_suite
node_nist_prep -->|"provides bitstreams"| node_nist_suite
node_user -->|"runs demonstration"| node_toy_attack

click node_image_demo "https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/image_demo.py"
click node_lrz_cli "https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/code/src/main.rs"
click node_cipher "https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/code/src/cipher.rs"
click node_aead_tool "https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/aead_file.py"
click node_metrics "https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/image_metrics.py"
click node_nist_prep "https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/make_nist_bits.py"
click node_stats "https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/analysis/stats.py"
click node_toy_attack "https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/attack/equivalent_key_attack.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_image_demo,node_lrz_cli,node_cipher,node_image_files,node_user toneBlue
class node_aead_tool,node_whole_files toneAmber
class node_metrics,node_nist_prep,node_nist_suite toneMint
class node_stats toneRose
class node_toy_attack toneIndigo
```

## Components

### Image Cipher

- [Image Adapter](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/image_demo.py): `scripts/image_demo.py`
- [LRZ CLI](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/code/src/main.rs): `code/src/main.rs`
- [Cipher Engine](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/code/src/cipher.rs): `code/src/cipher.rs`
- **Image Files**

### AES File Tool

- [AES-GCM Tool](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/aead_file.py): `scripts/aead_file.py`
- **Whole Files**

### Evaluation

- [Image Metrics](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/image_metrics.py): `scripts/image_metrics.py`
- [NIST Prep](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/scripts/make_nist_bits.py): `scripts/make_nist_bits.py`
- **NIST Suite**

### Analysis

- [Image Statistics](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/analysis/stats.py): `analysis/stats.py`

### Research Demo

- [Toy Key Attack](https://github.com/hawike22405/lorenz-blake3-cipher/blob/master/attack/equivalent_key_attack.py): `attack/equivalent_key_attack.py`

### Other components

- **User**

## Connections

- User → Image Adapter: selects image (evidence: `README.md`)
- Image Adapter → Image Files: reads and writes (evidence: `scripts/image_demo.py`)
- Image Adapter → LRZ CLI: invokes (evidence: `scripts/image_demo.py`)
- User → LRZ CLI: runs commands (evidence: `README.md`)
- LRZ CLI → Cipher Engine: encrypts, decrypts, verifies (evidence: `code/src/main.rs`)
- LRZ CLI → Image Files: reads and writes (evidence: `code/src/main.rs`)
- User → AES-GCM Tool: requests operation (evidence: `README.md`)
- AES-GCM Tool → Whole Files: reads and writes (evidence: `scripts/aead_file.py`)
- User → Image Metrics: runs evaluation (evidence: `README.md`)
- Image Metrics → LRZ CLI: invokes encryption and decryption (evidence: `scripts/image_metrics.py`)
- User → Image Statistics: requests statistics (evidence: `README.md`)
- Image Metrics → Image Statistics: uses statistics (evidence: `scripts/image_metrics.py`)
- User → NIST Prep: prepares bitstreams (evidence: `README.md`)
- NIST Prep → Image Files: reads containers (evidence: `scripts/make_nist_bits.py`)
- User → NIST Suite: runs tests (evidence: `README.md`)
- NIST Prep → NIST Suite: provides bitstreams (evidence: `README.md`)
- User → Toy Key Attack: runs demonstration (evidence: `README.md`)
