# zer0k7/descry architecture

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

- Interactive diagram: https://gitdiagram.com/zer0k7/descry
- Repository: https://github.com/zer0k7/descry

## Overview

descry is a command-line tool for identifying encodings, peeling layered transformations, and cracking or directly operating on Caesar, Vigenere, and XOR ciphers. Its main workflow reads text from an argument, file, or stdin; applies detection and/or decoding and cipher analysis; ranks candidates with a shared English-scoring model; and renders results for terminal or piped use. The graph includes documented frequency analysis and direct cipher commands. Some CLI code is excerpted only partially, so edges rely on shown calls, source-index references, or README statements; unsampled relationships are omitted.

Main entry points: [`descry/cli.py`](https://github.com/zer0k7/descry/blob/main/descry/cli.py) (Command handlers), [`descry/encodings/detect.py`](https://github.com/zer0k7/descry/blob/main/descry/encodings/detect.py) (Encoding detection), [`descry/scoring.py`](https://github.com/zer0k7/descry/blob/main/descry/scoring.py) (English scoring), [`descry/ciphers/caesar.py`](https://github.com/zer0k7/descry/blob/main/descry/ciphers/caesar.py) (Caesar cipher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI and I/O"]
  node_cli["Command handlers<br/>[cli.py]"]
  node_input["Input reader<br/>[io.py]"]
  node_output["Result rendering<br/>[output.py]"]
end

subgraph group_transform["Encoding and Detection"]
  node_identify["Identify and crack<br/>[cli.py]"]
  node_encoding_detect["Encoding detection<br/>[detect.py]"]
  node_decode["Layered decoding<br/>[decode.py]"]
end

subgraph group_cipher["Cipher Operations"]
  node_caesar["Caesar cipher<br/>[caesar.py]"]
  node_vigenere["Vigenere cipher<br/>[vigenere.py]"]
  node_xor["XOR cipher<br/>[xor.py]"]
end

subgraph group_analysis["Scoring and Results"]
  node_frequency["Frequency analysis<br/>[cli.py]"]
  node_scoring["English scoring<br/>[scoring.py]"]
end

node_user(("Command-line user"))

node_user -->|"runs commands"| node_cli
node_cli -->|"reads text"| node_input
node_cli -->|"dispatches"| node_identify
node_identify -->|"detects or cracks"| node_encoding_detect
node_cli -->|"peels layers"| node_decode
node_encoding_detect -->|"decodes candidates"| node_decode
node_encoding_detect -->|"tests cipher"| node_caesar
node_encoding_detect -->|"tests cipher"| node_vigenere
node_encoding_detect -->|"tests cipher"| node_xor
node_decode -->|"applies ROT13"| node_caesar
node_cli -->|"runs operations"| node_caesar
node_cli -->|"runs operations"| node_vigenere
node_cli -->|"runs operations"| node_xor
node_cli -->|"requests analysis"| node_frequency
node_frequency -->|"computes statistics"| node_scoring
node_caesar -->|"ranks candidates"| node_scoring
node_vigenere -->|"uses shifts"| node_caesar
node_vigenere -->|"scores candidates"| node_scoring
node_xor -->|"scores candidates"| node_scoring
node_decode -->|"scores decoded text"| node_scoring
node_encoding_detect -->|"scores candidates"| node_scoring
node_cli -->|"renders results"| node_output

click node_cli "https://github.com/zer0k7/descry/blob/main/descry/cli.py"
click node_input "https://github.com/zer0k7/descry/blob/main/descry/io.py"
click node_output "https://github.com/zer0k7/descry/blob/main/descry/output.py"
click node_identify "https://github.com/zer0k7/descry/blob/main/descry/cli.py"
click node_encoding_detect "https://github.com/zer0k7/descry/blob/main/descry/encodings/detect.py"
click node_decode "https://github.com/zer0k7/descry/blob/main/descry/encodings/decode.py"
click node_caesar "https://github.com/zer0k7/descry/blob/main/descry/ciphers/caesar.py"
click node_vigenere "https://github.com/zer0k7/descry/blob/main/descry/ciphers/vigenere.py"
click node_xor "https://github.com/zer0k7/descry/blob/main/descry/ciphers/xor.py"
click node_frequency "https://github.com/zer0k7/descry/blob/main/descry/cli.py"
click node_scoring "https://github.com/zer0k7/descry/blob/main/descry/scoring.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_cli,node_input,node_output,node_user toneBlue
class node_identify,node_encoding_detect,node_decode toneAmber
class node_caesar,node_vigenere,node_xor toneMint
class node_frequency,node_scoring toneRose
```

## Components

### CLI and I/O

- [Command handlers](https://github.com/zer0k7/descry/blob/main/descry/cli.py): `descry/cli.py`
- [Input reader](https://github.com/zer0k7/descry/blob/main/descry/io.py): `descry/io.py`
- [Result rendering](https://github.com/zer0k7/descry/blob/main/descry/output.py): `descry/output.py`

### Encoding and Detection

- [Identify and crack](https://github.com/zer0k7/descry/blob/main/descry/cli.py): `descry/cli.py`
- [Encoding detection](https://github.com/zer0k7/descry/blob/main/descry/encodings/detect.py): `descry/encodings/detect.py`
- [Layered decoding](https://github.com/zer0k7/descry/blob/main/descry/encodings/decode.py): `descry/encodings/decode.py`

### Cipher Operations

- [Caesar cipher](https://github.com/zer0k7/descry/blob/main/descry/ciphers/caesar.py): `descry/ciphers/caesar.py`
- [Vigenere cipher](https://github.com/zer0k7/descry/blob/main/descry/ciphers/vigenere.py): `descry/ciphers/vigenere.py`
- [XOR cipher](https://github.com/zer0k7/descry/blob/main/descry/ciphers/xor.py): `descry/ciphers/xor.py`

### Scoring and Results

- [Frequency analysis](https://github.com/zer0k7/descry/blob/main/descry/cli.py): `descry/cli.py`
- [English scoring](https://github.com/zer0k7/descry/blob/main/descry/scoring.py): `descry/scoring.py`

### Other components

- **Command-line user**

## Connections

- Command-line user → Command handlers: runs commands (evidence: `README.md`)
- Command handlers → Input reader: reads text (evidence: `descry/cli.py`)
- Command handlers → Identify and crack: dispatches (evidence: `descry/cli.py`)
- Identify and crack → Encoding detection: detects or cracks (evidence: `descry/cli.py`)
- Command handlers → Layered decoding: peels layers (evidence: `descry/cli.py`)
- Encoding detection → Layered decoding: decodes candidates (evidence: `descry/encodings/detect.py`)
- Encoding detection → Caesar cipher: tests cipher (evidence: `descry/encodings/detect.py`)
- Encoding detection → Vigenere cipher: tests cipher (evidence: `descry/encodings/detect.py`)
- Encoding detection → XOR cipher: tests cipher (evidence: `descry/encodings/detect.py`)
- Layered decoding → Caesar cipher: applies ROT13 (evidence: `descry/encodings/decode.py`)
- Command handlers → Caesar cipher: runs operations (evidence: `descry/cli.py`)
- Command handlers → Vigenere cipher: runs operations (evidence: `descry/cli.py`)
- Command handlers → XOR cipher: runs operations (evidence: `descry/cli.py`)
- Command handlers → Frequency analysis: requests analysis (evidence: `descry/cli.py`)
- Frequency analysis → English scoring: computes statistics (evidence: `descry/cli.py`)
- Caesar cipher → English scoring: ranks candidates (evidence: `descry/ciphers/caesar.py`)
- Vigenere cipher → Caesar cipher: uses shifts (evidence: `descry/ciphers/vigenere.py`)
- Vigenere cipher → English scoring: scores candidates (evidence: `descry/ciphers/vigenere.py`)
- XOR cipher → English scoring: scores candidates (evidence: `descry/ciphers/xor.py`)
- Layered decoding → English scoring: scores decoded text (evidence: `descry/encodings/decode.py`)
- Encoding detection → English scoring: scores candidates (evidence: `descry/encodings/detect.py`)
- Command handlers → Result rendering: renders results (evidence: `descry/cli.py`)
