Skip to content

yasha1971-coder/glyph-v8

Repository files navigation

CI

STRIDE v1 — Deterministic Corpus Analysis Toolkit

STRIDE v1 is a minimal, deterministic analysis toolkit for structured binary corpora. It provides byte‑exact, reproducible inspection tools designed for transparent, measurable, and fully deterministic workflows.

This project revives and modernizes the original glyph‑v8 prototype, transforming it into a clean, well‑defined analysis engine focused on determinism and reproducibility.


✨ Key Principles

  • Determinism — identical input always produces identical output
  • Transparency — no heuristics, no randomness, no hidden state
  • Reproducibility — stable algorithms, stable CLI, stable results
  • Corpus‑centric design — operates directly on raw STRIDE containers
  • Minimalism — small codebase, clear architecture, no external dependencies

📦 What STRIDE v0 Provides

STRIDE v1 performs four deterministic analyses on binary corpora:

  1. Byte Frequency — global frequency distribution of all 256 byte values.
  2. Hotspots — local entropy peaks across the corpus.
  3. Fingerprint — rolling‑hash + bottom‑k MinHash content signature.
  4. HeaderSketch — 64‑slot structural entropy sketch.

Each module is implemented as a standalone Python file and exposed through a unified CLI.

v1 adds:

  • container-write — encode any raw file into a deterministic STRIDE container
  • container-decode — decode container back to raw file (round-trip verified, MD5-exact)

🧩 Architecture Overview

stride/
 ├── cli.py                     # Unified command-line interface
 ├── container_writer.py        # Encoder: raw file → STRIDE container
 ├── container_decoder.py       # Decoder: STRIDE container → raw file
 ├── container_reader.py        # Binary container reader
 ├── container_bytefreq.py      # Byte-frequency analysis
 ├── container_hotspots.py      # Entropy hotspot analysis
 ├── container_fingerprint.py   # Rolling fingerprint
 ├── container_headersketch.py  # Structural header sketch
 ├── glyph_pack.py              # Artifact packer
 ├── glyph_store.py             # Artifact storage
 └── configs/
      └── eval_matrix.json      # Analysis configuration

🚀 Installation

pip install -e .

🖥 Try it in 30 seconds

git clone https://github.com/yasha1971-coder/glyph-v8
cd glyph-v8
pip install -e .
stride --help

Build a container and run analysis:

# Encode raw file into STRIDE container
stride container-write enwik8 enwik8.stridebin

# Run analysis
stride container-bytefreq enwik8.stridebin --top 10
stride container-hotspots enwik8.stridebin --top 5
stride container-fingerprint enwik8.stridebin --k 128 --window 32
stride container-headersketch enwik8.stridebin --size 64

# Decode back to raw (round-trip verified)
stride container-decode enwik8.stridebin enwik8_out



⚡ STRIDE vs zstd — I/O Performance (enwik8, 100MB, OVH EPYC)

STRIDE is not a compressor — it is a deterministic container. Comparison is I/O throughput only.

Operation Tool Time Size
Encode / Compress STRIDE 0.173s 96MB
Encode / Compress zstd -1 0.240s 39MB
Encode / Compress zstd -9 2.146s 31MB
Decode / Decompress STRIDE 0.089s 100MB
Decode / Decompress zstd -d 0.125s 100MB

STRIDE encode: 28% faster than zstd -1 STRIDE decode: 40% faster than zstd -d

Trade-off: STRIDE does not compress. Use zstd for compression. Use STRIDE for deterministic container I/O.

⚡ STRIDE v1 — Encoder/Decoder Performance (enwik8, 100MB)

Hardware: OVH EPYC server

Operation Time Speed
container-write 0.174s ~575 MB/s
container-decode 0.095s ~1,053 MB/s
Round-trip 0.269s MD5-verified

📊 Benchmark Results — STRIDE v1 (enwik8, 100MB)

Hardware: OVH EPYC server

Module Time Output
ByteFreq 1.97s 256-byte histogram, top byte: 0x20 space (13.52%)
Hotspots 4.17s Max entropy: 5.685 (chunk 635)
HeaderSketch 4.40s 64-slot structural profile
Fingerprint 71.6s 128 MinHash values (known: O(n·k) rolling hash)
Total ~82s Full corpus analysis

SHA256-verified proof: <proof/enwik8_benchmark.txt>


📁 Output Artifacts

  • bytefreq.txt — 256-line byte histogram
  • hotspots.txt — entropy peaks by chunk
  • fingerprint.txt — rolling MinHash signature
  • headersketch.txt — 64-slot structural sketch
  • *.stridebin — deterministic container format (encode/decode round-trip verified)

🧪 Tests

pytest tests/

4 tests — all passing:

  • test_roundtrip_small — MD5-verified round-trip
  • test_container_metadata — corpus_size + chunk_size verified
  • test_roundtrip_exact_chunk — exact 64KB chunk
  • test_roundtrip_partial_chunk — partial last chunk

📜 Project Lineage

STRIDE is the third primitive in a deterministic systems family:

  • ACEAPEX — parallel LZ77 decode (9,903 MB/s, merged into lzbench)
  • GLYPH — deterministic byte-exact retrieval (6,888× faster than grep)
  • STRIDE — field-aware integer analysis for binary protocols

Same philosophy: deterministic, exact, measurable.


📜 License

MIT License.

About

Minimal deterministic analyzer for STRIDE containers (STRIDE v0)

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Sponsor this project

 

Packages

 
 
 

Contributors

Languages