Skip to main content

Crate entviz

Crate entviz 

Source
Expand description

entviz — Rust reference port. The spec version it targets and emits is SPEC_VERSION.

This crate is a full, self-contained entviz implementation: the deterministic shared core (tokenization + quant extension, the SHA-512 fingerprint, ftok median/quartile selection, the Oklab color rules, grid selection), the format-specific parsers (entropy), and the SVG renderer (pipeline::render). It passes the shared conformance corpus at Tier A (render model) + Tier B (canonical raster) for every render vector, rejects every error vector, and satisfies every invariant pair. Certify with:

cargo build --release --bin entviz-conformance
# from the entviz repo:
PYTHONPATH=src:. python -m compliance.runner \
    --impl-cmd '/path/to/entviz-rs/target/release/entviz-conformance'

The entviz-conformance binary (src/main.rs) implements the stdin/stdout contract in the entviz repo’s compliance/README.md.

Modules§

characterize
Entropy characterization model + label projection — port of src/entviz/characterize.py.
entropy
Format-specific entropy parsing (port of src/entviz/entropy.py).
keccak
Minimal pure-Rust Keccak-256 (the original Keccak, NOT NIST SHA3-256).
pipeline
Full render pipeline: entropy string → SVG string.

Structs§

Alphabet
Grid
Token
VisualStyle

Constants§

BASE64URL
HEX
MIDDLE_DOMAIN_TAG
Domain tag for the second, domain-separated digest. The trailing NUL is included. v6 is the construction version (fixed), NOT the spec version.
POSSIBLE_EDGE_COLORS
SPEC_VERSION

Functions§

choose_grid
closest_palette_color
compute_fingerprint
median_token
nucleus_colors
Returns (bg_hex, fg_hex). Red is the low byte of the quant (CSS order).
oklab_lightness
quartile_tokens
second_digest
second = SHA-512(DOMAIN_TAG ‖ core). Computed for every input; drives the two color-bar markers on all inputs (and the middle cells on large ones). A legitimate part of the renderer — not adversarial tooling.
select_visual_style
tokenize
tokenize_fingerprint
weighted_rgb_distance