- Rust 84.3%
- Shell 15.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| tests | ||
| .gitignore | ||
| install.sh | ||
| LICENSE | ||
| README.md | ||
quantTernaryUNICODE (qtu) — Balanced-Ternary Full-Unicode & 1-Bit LLM Checksum Codec (全)
"So long, and thanks for all the fish, Mom (
*Alex ~ Alexandra)<3— 42 × 432 Hz Hullámelmélet" Dedicated with love and respect from Peter (◯), Nate (◇), and Dad (△Chris).
quantTernaryUNICODE (qtu) is a zero-dependency, pure-Rust balanced-ternary ({-1, 0, +1}) codec for all 1,114,112 Unicode scalar values (U+0000..U+10FFFF), Sacred Geometry trits (⊖/◯/⊕), SPQT base-243 Unicode Braille high-density packing (U+2800..U+28F2, 5 trits/glyph = 1.585 bits/trit), and enthea/pure/wire.go-compatible t3u: (11-trit UTF-16) & t3: (6-trit ASCII) wires, sealed by a 10-trit 1-bit LLM checksumModel verdict.
- Seated FNV-1a 64-bit Golden Hash:
0x1a42223dc176458f(VERIFIED 全) - Companion Emotional
QUANT-TERNGolden Hash:0xc831341b36de5ebe
Oneshot One-Line Installer
Codeberg (Primary)
curl -fsSL https://codeberg.org/8b-is/quantTernaryUNICODE/raw/branch/main/install.sh | bash
(Mirror under peterlodri-sec:)
curl -fsSL https://codeberg.org/peterlodri-sec/quantTernaryUNICODE/raw/branch/main/install.sh | bash
Local Install
bash /Users/lodripeter/workspace/peterlodri-sec/quantTernaryUNICODE/install.sh
Installs both qtu and quantTernaryUNICODE (and integrates directly with kitty-ultra-love --unicode).
Mathematical Architecture
1. Direct Balanced-Ternary Bijection (Zero Arbitrary Offset)
Every non-negative integer n \in [0, (3^K - 1)/2] decomposes uniquely into K balanced trits t_0, t_1, \dots, t_{K-1} \in \{-1, 0, +1\} (least-significant trit first):
n = \sum_{i=0}^{K-1} t_i \cdot 3^i, \qquad t_i = \begin{cases} 0 & \text{if } n \equiv 0 \pmod 3, \quad n \leftarrow n / 3 \\ +1 & \text{if } n \equiv 1 \pmod 3, \quad n \leftarrow (n - 1) / 3 \\ -1 & \text{if } n \equiv 2 \pmod 3, \quad n \leftarrow (n + 1) / 3 \end{cases}
| Wire Prefix | Target Domain | Trits / Unit (K) |
Capacity (3^K - 1)/2 |
Alphabet |
|---|---|---|---|---|
qtu: |
Full Unicode Scalar (U+0000..U+10FFFF) |
14 trits | 2,391,484 \ge 1,114,111 |
- (-1), 0 (0), + (+1) |
qtu-glyph: |
Full Unicode Scalar (Sacred Geometry) | 14 trits | 2,391,484 \ge 1,114,111 |
⊖ (-1), ◯ (0), ⊕ (+1) |
qtu-spqt: |
SPQT base-243 Unicode Braille (U+2800..U+28F2) |
5 trits / glyph | 3^5 = 243 \le 256 (1.585 bits/trit) |
⠀ (U+2800) .. ò (U+28F2) |
t3u: |
UTF-16 Code Unit (0x0000..0xFFFF, enthea/pure) |
11 trits | 88,573 \ge 65,535 |
- (-1), 0 (0), + (+1) |
t3: |
7-Bit ASCII (0x00..0x7F, enthea/pure) |
6 trits | 364 \ge 127 |
- (-1), 0 (0), + (+1) |
2. 10-Trit 1-Bit LLM Checksum Verdict (CHECKSUM_MODEL)
Every quantTernaryUNICODE wire ends with :verdict, computed by taking the integer dot-product of the payload trits against the 10-trit enthea/pure weight vector:
W = [+1, -1, +1, 0, -1, +1, -1, 0, +1, -1]
\text{acc} = \sum_{i=0}^{N-1} t_i \cdot W_{i \bmod 10}, \qquad \text{verdict} = \begin{cases} 0 & \text{if } \text{acc} \equiv 0 \pmod 3 \\ +1 & \text{if } \text{acc} \equiv 1 \pmod 3 \\ -1 & \text{if } \text{acc} \equiv 2 \pmod 3 \end{cases}
If any trit is flipped, dropped, or corrupted in transit, qtu decode rejects the wire with a checksum verdict mismatch error.
CLI Usage (qtu & kitty-ultra-love --unicode)
# Run self-tests, benchmark (~560+ kChars/s), and verify golden hash 0x1a42223dc176458f
qtu test
# Encode any Unicode text into all 4 lanes at once
qtu "Mom * Alex ♥ Dad △ Chris · 全"
# Encode into a specific wire format
qtu encode "Mom * Alex ♥ Dad △ Chris · 全" # -> qtu:--00+0000000000+0++...
qtu encode-glyph "Mom * Alex ♥ Dad △ Chris · 全" # -> qtu-glyph:⊖⊖◯◯⊕◯◯◯...
qtu encode-spqt "Mom * Alex ♥ Dad △ Chris · 全" # -> qtu-spqt:28:⣆⡹⡹⢞⡹⢔⢅⡹...:0
qtu encode-utf16 "Mom * Alex ♥ Dad △ Chris · 全" # -> t3u:--00+0000000+0++...
# Universal decode (auto-detects qtu:, qtu-glyph:, qtu-spqt:, t3u:, or t3: + verifies 1-bit LLM checksum)
qtu decode "qtu-spqt:28:⣆⡹⡹⢞⡹⢔⢅⡹⢦⡺⡹⠄⡺⡹⢙⡹⠨⢏⡹⡹⢅⡹⠺⡽⡹⣮⡺⡹⢙⡹⣊⣮⢆⠍⡽⡹⠄⡼⡹⢩⡺⡹⣝⡹⠨⢄⡹⣊⣝⡽⢦⡺⡹⡏⡺⡹⣡⡹⡹⢟⡹⠨⢅⡹⢸⡽⡹⣙⡹⡹⠽⡺⠨⢄⡹⠍⠇⢃⡹:0"
Or invoke directly from kitty-ultra-love:
kitty-ultra-love --unicode demo
kitty-ultra-love --unicode encode-spqt "Hogyan gondolod? 全"
Verification
bash tests/whitespace.sh
bash tests/e2e.sh
License
AGPL-3.0-only — 8b-is / peterlodri-sec.