# sheepchef/abracadabra architecture

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

- Interactive diagram: https://gitdiagram.com/sheepchef/abracadabra
- Repository: https://github.com/sheepchef/abracadabra

## Overview

Abracadabra is a JavaScript text and byte-array encryption library that encodes encrypted data as Chinese text, with an optional classical-Chinese-style simulation. The main workflow enters through the public API, which delegates encryption or decryption to the core handler; that handler coordinates compression, cryptography, and character mapping. The README documents the broader transform stages, including Base64 and rotor obfuscation. Separate capabilities include configurable advanced encryption and 熊曰 (Xiongyue) decryption. Relationships for unsampled internals are shown only where documented; source excerpts do not expose every call site.

Main entry points: [`src/javascript/CoreHandler.js`](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/CoreHandler.js) (Core Handler), [`src/javascript/ChineseMappingHelper.js`](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/ChineseMappingHelper.js) (Chinese Mapping), [`src/javascript/main.js`](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/main.js) (Abracadabra API), [`src/javascript/CompressionHelper.js`](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/CompressionHelper.js) (Compression)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_api["Abracadabra API<br/>[main.js]"]
  node_core["Core Handler<br/>[CoreHandler.js]"]
end

subgraph group_pipeline["Encoding Pipeline"]
  node_mapping["Chinese Mapping"]
  node_tables["Mapping Tables<br/>[mapping.json]"]
  node_simtables["Simulation Tables<br/>[mapping_next.json]"]
  node_rotor["Rotor Obfuscation"]
end

subgraph group_security["Security and Compression"]
  node_compress["Compression"]
  node_unishox["Unishox2 Codec<br/>[unishox2.js]"]
  node_crypto["Encryption Suites<br/>[EncryptHelper.js]"]
  node_misc["Crypto Utilities<br/>[Misc.js]"]
  node_rng["Secure Random<br/>[CSPRNGHelper.js]"]
end

subgraph group_compat["Compatibility"]
  node_bear["Xiongyue Decoder"]
end

node_user(("Caller"))

node_user -->|"calls"| node_api
node_api -->|"delegates"| node_core
node_core -->|"compresses data"| node_compress
node_core -->|"encrypts data"| node_crypto
node_core -->|"maps text"| node_mapping
node_mapping -->|"uses rotors"| node_rotor
node_compress -->|"uses codec"| node_unishox
node_core -->|"uses utilities"| node_misc
node_misc -->|"gets randomness"| node_rng
node_mapping -.->|"uses traditional map"| node_tables
node_mapping -.->|"uses simulation map"| node_simtables
node_api -->|"decodes 熊曰"| node_bear

click node_api "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/main.js"
click node_core "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/CoreHandler.js"
click node_mapping "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/ChineseMappingHelper.js"
click node_tables "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/mapping.json"
click node_simtables "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/mapping_next.json"
click node_rotor "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/RoundObfusHelper.js"
click node_compress "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/CompressionHelper.js"
click node_unishox "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/unishox2.js"
click node_crypto "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/EncryptHelper.js"
click node_misc "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/Misc.js"
click node_rng "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/CSPRNGHelper.js"
click node_bear "https://github.com/sheepchef/abracadabra/blob/main/src/javascript/XiongyueDecHelper.js"

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_api,node_core toneBlue
class node_mapping,node_tables,node_simtables,node_rotor toneAmber
class node_compress,node_unishox,node_crypto,node_misc,node_rng toneMint
class node_bear toneRose
class node_user toneIndigo
```

## Components

### Public API

- [Abracadabra API](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/main.js): `src/javascript/main.js`
- [Core Handler](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/CoreHandler.js): `src/javascript/CoreHandler.js`

### Encoding Pipeline

- [Chinese Mapping](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/ChineseMappingHelper.js): `src/javascript/ChineseMappingHelper.js`
- [Mapping Tables](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/mapping.json): `src/javascript/mapping.json`
- [Simulation Tables](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/mapping_next.json): `src/javascript/mapping_next.json`
- [Rotor Obfuscation](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/RoundObfusHelper.js): `src/javascript/RoundObfusHelper.js`

### Security and Compression

- [Compression](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/CompressionHelper.js): `src/javascript/CompressionHelper.js`
- [Unishox2 Codec](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/unishox2.js): `src/javascript/unishox2.js`
- [Encryption Suites](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/EncryptHelper.js): `src/javascript/EncryptHelper.js`
- [Crypto Utilities](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/Misc.js): `src/javascript/Misc.js`
- [Secure Random](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/CSPRNGHelper.js): `src/javascript/CSPRNGHelper.js`

### Compatibility

- [Xiongyue Decoder](https://github.com/sheepchef/abracadabra/blob/main/src/javascript/XiongyueDecHelper.js): `src/javascript/XiongyueDecHelper.js`

### Other components

- **Caller**

## Connections

- Caller → Abracadabra API: calls (evidence: `README.md`)
- Abracadabra API → Core Handler: delegates (evidence: `src/javascript/main.js`)
- Core Handler → Compression: compresses data (evidence: `README.md`)
- Core Handler → Encryption Suites: encrypts data (evidence: `src/javascript/CoreHandler.js`)
- Core Handler → Chinese Mapping: maps text (evidence: `src/javascript/CoreHandler.js`)
- Chinese Mapping → Rotor Obfuscation: uses rotors (evidence: `src/javascript/ChineseMappingHelper.js`)
- Compression → Unishox2 Codec: uses codec (evidence: `src/javascript/CompressionHelper.js`)
- Core Handler → Crypto Utilities: uses utilities (evidence: `src/javascript/CoreHandler.js`)
- Crypto Utilities → Secure Random: gets randomness (evidence: `src/javascript/Misc.js`)
- Chinese Mapping → Mapping Tables: uses traditional map (evidence: `README.md`)
- Chinese Mapping → Simulation Tables: uses simulation map (evidence: `README.md`)
- Abracadabra API → Xiongyue Decoder: decodes 熊曰 (evidence: `src/javascript/main.js`)
