# yesdisown/e-ng architecture

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

- Interactive diagram: https://gitdiagram.com/yesdisown/e-ng
- Repository: https://github.com/yesdisown/e-ng

## Overview

e-ng is a Rust command-line C++ obfuscator. Its workflow reads source from a file or stdin, chooses charset- or phrase-based macro naming, tokenizes C++, assigns collision-avoiding names to eligible tokens, renders directives and obfuscated code, then writes to a file or stdout. The graph separates CLI I/O, token processing, macro generation, and output formatting. Source excerpts support the core calls; optional runtime capabilities documented in the README are included where applicable.

Main entry points: [`src/main.rs`](https://github.com/yesdisown/e-ng/blob/main/src/main.rs) (File and stream I/O), [`src/lib.rs`](https://github.com/yesdisown/e-ng/blob/main/src/lib.rs) (Obfuscation coordinator), [`src/macros.rs`](https://github.com/yesdisown/e-ng/blob/main/src/macros.rs) (Macro name generator), [`src/lexer.rs`](https://github.com/yesdisown/e-ng/blob/main/src/lexer.rs) (C++ tokenizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and I/O"]
  node_cli["CLI and configuration<br/>[main.rs]"]
  node_io["File and stream I/O<br/>[main.rs]"]
end

subgraph group_processing["C++ Processing"]
  node_pipeline["Obfuscation coordinator<br/>[lib.rs]"]
  node_lexer["C++ tokenizer<br/>[lexer.rs]"]
  node_tokens["Token stream"]
  node_filter["Token selection<br/>[lib.rs]"]
  node_mapping["Token macro mapping<br/>[lib.rs]"]
  node_shuffle["Define ordering<br/>[lib.rs]"]
end

subgraph group_generation["Macro Generation"]
  node_keywords["C++ keyword set<br/>[macros.rs]"]
  node_mode["Name mode validation<br/>[macros.rs]"]
  node_generator["Macro name generator<br/>[macros.rs]"]
end

subgraph group_rendering["Output Rendering"]
  node_formatter["Output formatter<br/>[formatter.rs]"]
end

node_user(("User"))
node_input["C++ source"]
node_result["Obfuscated C++"]
node_dictionary["Phrase dictionary"]
node_rand["Random shuffle"]
node_filesystem[("Filesystem")]
node_stdin["stdin"]
node_stdout["stdout"]

node_user -->|"selects options"| node_cli
node_user -->|"provides source"| node_input
node_cli -->|"reads and writes"| node_io
node_io -->|"accesses files"| node_filesystem
node_io -->|"reads input"| node_stdin
node_io -->|"writes output"| node_stdout
node_io -->|"loads phrases"| node_dictionary
node_cli -->|"builds naming mode"| node_mode
node_io -->|"passes source and config"| node_pipeline
node_pipeline -->|"tokenizes source"| node_lexer
node_lexer -->|"produces tokens"| node_tokens
node_pipeline -->|"loads reserved words"| node_keywords
node_pipeline -->|"selects eligible tokens"| node_filter
node_filter -->|"requests names"| node_generator
node_mode -->|"configures naming"| node_generator
node_generator -->|"assigns macro names"| node_mapping
node_mapping -->|"orders definitions"| node_shuffle
node_shuffle -->|"randomizes when enabled"| node_rand
node_pipeline -->|"renders token stream"| node_formatter
node_formatter -->|"produces C++ text"| node_result
node_io -->|"writes result"| node_result

click node_cli "https://github.com/yesdisown/e-ng/blob/main/src/main.rs"
click node_io "https://github.com/yesdisown/e-ng/blob/main/src/main.rs"
click node_pipeline "https://github.com/yesdisown/e-ng/blob/main/src/lib.rs"
click node_lexer "https://github.com/yesdisown/e-ng/blob/main/src/lexer.rs"
click node_filter "https://github.com/yesdisown/e-ng/blob/main/src/lib.rs"
click node_keywords "https://github.com/yesdisown/e-ng/blob/main/src/macros.rs"
click node_mode "https://github.com/yesdisown/e-ng/blob/main/src/macros.rs"
click node_generator "https://github.com/yesdisown/e-ng/blob/main/src/macros.rs"
click node_mapping "https://github.com/yesdisown/e-ng/blob/main/src/lib.rs"
click node_shuffle "https://github.com/yesdisown/e-ng/blob/main/src/lib.rs"
click node_formatter "https://github.com/yesdisown/e-ng/blob/main/src/formatter.rs"

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_io,node_user toneBlue
class node_pipeline,node_lexer,node_tokens,node_filter,node_mapping,node_shuffle,node_filesystem toneAmber
class node_keywords,node_mode,node_generator toneMint
class node_formatter toneRose
class node_input,node_result,node_dictionary,node_rand,node_stdin,node_stdout toneIndigo
```

## Components

### CLI and I/O

- [CLI and configuration](https://github.com/yesdisown/e-ng/blob/main/src/main.rs): `src/main.rs`
- [File and stream I/O](https://github.com/yesdisown/e-ng/blob/main/src/main.rs): `src/main.rs`

### C++ Processing

- [Obfuscation coordinator](https://github.com/yesdisown/e-ng/blob/main/src/lib.rs): `src/lib.rs`
- [C++ tokenizer](https://github.com/yesdisown/e-ng/blob/main/src/lexer.rs): `src/lexer.rs`
- **Token stream**
- [Token selection](https://github.com/yesdisown/e-ng/blob/main/src/lib.rs): `src/lib.rs`
- [Token macro mapping](https://github.com/yesdisown/e-ng/blob/main/src/lib.rs): `src/lib.rs`
- [Define ordering](https://github.com/yesdisown/e-ng/blob/main/src/lib.rs): `src/lib.rs`

### Macro Generation

- [C++ keyword set](https://github.com/yesdisown/e-ng/blob/main/src/macros.rs): `src/macros.rs`
- [Name mode validation](https://github.com/yesdisown/e-ng/blob/main/src/macros.rs): `src/macros.rs`
- [Macro name generator](https://github.com/yesdisown/e-ng/blob/main/src/macros.rs): `src/macros.rs`

### Output Rendering

- [Output formatter](https://github.com/yesdisown/e-ng/blob/main/src/formatter.rs): `src/formatter.rs`

### Other components

- **User**
- **C++ source**
- **Obfuscated C++**
- **Phrase dictionary**
- **Random shuffle**
- **Filesystem**
- **stdin**
- **stdout**

## Connections

- User → CLI and configuration: selects options (evidence: `src/main.rs`)
- User → C++ source: provides source (evidence: `README.md`)
- CLI and configuration → File and stream I/O: reads and writes (evidence: `src/main.rs`)
- File and stream I/O → Filesystem: accesses files (evidence: `src/main.rs`)
- File and stream I/O → stdin: reads input (evidence: `src/main.rs`)
- File and stream I/O → stdout: writes output (evidence: `src/main.rs`)
- File and stream I/O → Phrase dictionary: loads phrases (evidence: `src/main.rs`)
- CLI and configuration → Name mode validation: builds naming mode (evidence: `src/main.rs`)
- File and stream I/O → Obfuscation coordinator: passes source and config (evidence: `src/main.rs`)
- Obfuscation coordinator → C++ tokenizer: tokenizes source (evidence: `src/lib.rs`)
- C++ tokenizer → Token stream: produces tokens (evidence: `src/lexer.rs`)
- Obfuscation coordinator → C++ keyword set: loads reserved words (evidence: `src/lib.rs`)
- Obfuscation coordinator → Token selection: selects eligible tokens (evidence: `src/lib.rs`)
- Token selection → Macro name generator: requests names (evidence: `src/lib.rs`)
- Name mode validation → Macro name generator: configures naming (evidence: `src/lib.rs`)
- Macro name generator → Token macro mapping: assigns macro names (evidence: `src/lib.rs`)
- Token macro mapping → Define ordering: orders definitions (evidence: `src/lib.rs`)
- Define ordering → Random shuffle: randomizes when enabled (evidence: `src/lib.rs`)
- Obfuscation coordinator → Output formatter: renders token stream (evidence: `src/lib.rs`)
- Output formatter → Obfuscated C++: produces C++ text (evidence: `src/formatter.rs`)
- File and stream I/O → Obfuscated C++: writes result (evidence: `src/main.rs`)
