# wpsdql888/kjk architecture

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

- Interactive diagram: https://gitdiagram.com/wpsdql888/kjk
- Repository: https://github.com/wpsdql888/kjk

## Overview

KJK Encryptor creates and opens encrypted `.kjk` packages through a Windows desktop application and a browser-based interface. The principal workflow selects files, encrypts them in a chosen format, and saves a package; opening a package enables decryption or directory-tree editing and saving. The legacy engine supports older formats, while KJKv9 provides binary packages and large-file processing. The README documents the web interface and local service, but the supplied excerpts do not show `index.html` internals. Edges rely on README statements or source-index references where noted.

Main entry points: [`python/main.py`](https://github.com/wpsdql888/kjk/blob/master/python/main.py) (Desktop UI), [`python/kjk9.py`](https://github.com/wpsdql888/kjk/blob/master/python/kjk9.py) (KJKv9 engine), [`python/engine.py`](https://github.com/wpsdql888/kjk/blob/master/python/engine.py) (Legacy formats), [`python/browse.py`](https://github.com/wpsdql888/kjk/blob/master/python/browse.py) (Package browser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop application"]
  node_desktop_app["Desktop UI<br/>[main.py]"]
  node_context_menu["Shell actions<br/>[context_menu.py]"]
  node_settings[("Configuration<br/>[config.py]")]
end

subgraph group_crypto["Encryption formats"]
  node_legacy_engine["Legacy formats<br/>[engine.py]"]
  node_kjkv9["KJKv9 engine<br/>[kjk9.py]"]
  node_c_engine["Token acceleration<br/>[kjkfast.c]"]
end

subgraph group_packages["Package management"]
  node_package_browser["Package browser<br/>[browse.py]"]
  node_encrypted_package["KJK package"]
  node_filesystem[("Local files")]
end

subgraph group_web["Web and local API"]
  node_web_ui["Browser interface<br/>[index.html]"]
  node_local_web["Local web service<br/>[www.py]"]
  node_api["Local API<br/>[api_server.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_desktop_app
node_user -->|"uses"| node_web_ui
node_desktop_app -->|"encrypts / decrypts"| node_legacy_engine
node_desktop_app -->|"dispatches KJKv9"| node_kjkv9
node_desktop_app -->|"loads settings"| node_settings
node_desktop_app -->|"opens browser"| node_package_browser
node_desktop_app -->|"manages actions"| node_context_menu
node_context_menu -->|"encrypts / decrypts"| node_legacy_engine
node_context_menu -->|"dispatches KJKv9"| node_kjkv9
node_context_menu -->|"reads settings"| node_settings
node_package_browser -->|"decrypts legacy"| node_legacy_engine
node_package_browser -->|"edits KJKv9"| node_kjkv9
node_package_browser -->|"reads settings"| node_settings
node_kjkv9 -->|"uses format helpers"| node_legacy_engine
node_kjkv9 -->|"reads tuning"| node_settings
node_legacy_engine -.->|"uses acceleration"| node_c_engine
node_desktop_app -->|"starts API"| node_api
node_api -->|"encrypts / decrypts"| node_legacy_engine
node_api -->|"manages packages"| node_kjkv9
node_api -->|"updates settings"| node_settings
node_web_ui -->|"creates / edits"| node_encrypted_package
node_web_ui -->|"reads local data"| node_filesystem
node_desktop_app -->|"saves / opens"| node_encrypted_package
node_package_browser -->|"exports files"| node_filesystem
node_local_web -.->|"serves locally"| node_web_ui

click node_desktop_app "https://github.com/wpsdql888/kjk/blob/master/python/main.py"
click node_context_menu "https://github.com/wpsdql888/kjk/blob/master/python/context_menu.py"
click node_settings "https://github.com/wpsdql888/kjk/blob/master/python/config.py"
click node_legacy_engine "https://github.com/wpsdql888/kjk/blob/master/python/engine.py"
click node_kjkv9 "https://github.com/wpsdql888/kjk/blob/master/python/kjk9.py"
click node_c_engine "https://github.com/wpsdql888/kjk/blob/master/python/kjkfast.c"
click node_package_browser "https://github.com/wpsdql888/kjk/blob/master/python/browse.py"
click node_web_ui "https://github.com/wpsdql888/kjk/blob/master/index.html"
click node_local_web "https://github.com/wpsdql888/kjk/blob/master/file/www.py"
click node_api "https://github.com/wpsdql888/kjk/blob/master/python/api_server.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_desktop_app,node_context_menu,node_settings,node_user toneBlue
class node_legacy_engine,node_kjkv9,node_c_engine toneAmber
class node_package_browser,node_encrypted_package,node_filesystem toneMint
class node_web_ui,node_local_web,node_api toneRose
```

## Components

### Desktop application

- [Desktop UI](https://github.com/wpsdql888/kjk/blob/master/python/main.py): `python/main.py`
- [Shell actions](https://github.com/wpsdql888/kjk/blob/master/python/context_menu.py): `python/context_menu.py`
- [Configuration](https://github.com/wpsdql888/kjk/blob/master/python/config.py): `python/config.py`

### Encryption formats

- [Legacy formats](https://github.com/wpsdql888/kjk/blob/master/python/engine.py): `python/engine.py`
- [KJKv9 engine](https://github.com/wpsdql888/kjk/blob/master/python/kjk9.py): `python/kjk9.py`
- [Token acceleration](https://github.com/wpsdql888/kjk/blob/master/python/kjkfast.c): `python/kjkfast.c`

### Package management

- [Package browser](https://github.com/wpsdql888/kjk/blob/master/python/browse.py): `python/browse.py`
- **KJK package**
- **Local files**

### Web and local API

- [Browser interface](https://github.com/wpsdql888/kjk/blob/master/index.html): `index.html`
- [Local web service](https://github.com/wpsdql888/kjk/blob/master/file/www.py): `file/www.py`
- [Local API](https://github.com/wpsdql888/kjk/blob/master/python/api_server.py): `python/api_server.py`

### Other components

- **User**

## Connections

- User → Desktop UI: uses (evidence: `README.md`)
- User → Browser interface: uses (evidence: `README.md`)
- Desktop UI → Legacy formats: encrypts / decrypts (evidence: `python/main.py`)
- Desktop UI → KJKv9 engine: dispatches KJKv9 (evidence: `python/main.py`)
- Desktop UI → Configuration: loads settings (evidence: `python/main.py`)
- Desktop UI → Package browser: opens browser (evidence: `python/main.py`)
- Desktop UI → Shell actions: manages actions (evidence: `python/main.py`)
- Shell actions → Legacy formats: encrypts / decrypts (evidence: `python/context_menu.py`)
- Shell actions → KJKv9 engine: dispatches KJKv9 (evidence: `python/context_menu.py`)
- Shell actions → Configuration: reads settings (evidence: `python/context_menu.py`)
- Package browser → Legacy formats: decrypts legacy (evidence: `python/browse.py`)
- Package browser → KJKv9 engine: edits KJKv9 (evidence: `python/browse.py`)
- Package browser → Configuration: reads settings (evidence: `python/browse.py`)
- KJKv9 engine → Legacy formats: uses format helpers (evidence: `python/kjk9.py`)
- KJKv9 engine → Configuration: reads tuning (evidence: `python/kjk9.py`)
- Legacy formats → Token acceleration: uses acceleration
- Desktop UI → Local API: starts API (evidence: `python/main.py`)
- Local API → Legacy formats: encrypts / decrypts (evidence: `python/api_server.py`)
- Local API → KJKv9 engine: manages packages (evidence: `python/api_server.py`)
- Local API → Configuration: updates settings (evidence: `python/api_server.py`)
- Browser interface → KJK package: creates / edits (evidence: `README.md`)
- Browser interface → Local files: reads local data (evidence: `README.md`)
- Desktop UI → KJK package: saves / opens (evidence: `README.md`)
- Package browser → Local files: exports files (evidence: `README.md`)
- Local web service → Browser interface: serves locally (evidence: `README.md`)
