AI Generated Visualizer finetuned for intuition not code quality
xxhash3.mov
Small standalone C/raylib program that visualizes the exact XXH3_64bits path used for one specific case:
- input text:
"xxhash3!" - input length:
8 - seed:
0 - secret source: the built-in XXH3 default secret
This repository is not an xxhash3 library and it does not implement the full family of XXH3 code paths. The app is an interactive teaching/inspection tool for the len=8 64-bit path only.
The program walks through the concrete values and bit-level transformations for:
- Packing the 8-byte input into the
input64value used by thelen=8entry path. - Building the
bitflipvalue fromreadLE64(secret + 8),readLE64(secret + 16), andseed'. - Computing
keyed = input64 XOR bitflip. - Running the first
XXH3_rrmxmxXOR/rotate stage. - Multiplying by
PRIME_MX2. - Applying
h ^= (h >> 35) + len. - Multiplying by
PRIME_MX2again. - Applying the final
h ^= h >> 28. - Emitting the final 64-bit hash.
- Showing a 64x64 avalanche grid for single-bit flips of the
input64value.
Most pages animate the operation step-by-step and let you hover bits or bytes to inspect how values move through the transform.
The UI has ten pages, selected with the top bar or number keys:
0: overview of the exact path and current concrete values1: input packing and first keyed XOR (input64 XOR bitflip)2: bitflip expansion from the default secret windows and seed adjustment3: firstrrmxmxXOR/rotate step4: first multiply byPRIME_MX25:h ^= (h >> 35) + len6: second multiply byPRIME_MX27: finalh ^= h >> 288: returned 64-bit hash bytes and final value9: avalanche grid for one-bit input flips
ccor another C compilerraylib- optionally
pkg-config
The Makefile first tries pkg-config --cflags raylib and pkg-config --libs raylib. If that fails, it falls back to:
-lraylib -lm -lpthread -ldlThat fallback is aimed at common Unix-like setups, but raylib still needs to be installed and linkable on your machine.
makeThis produces the executable:
./xxhash3_vizmake runmake clean0through9: switch pages- click page buttons in the top bar: switch pages
space: pause or resume the page animationr: reset the current page animationq: quit- move the mouse over bits, bytes, secret windows, or avalanche cells: inspect mappings and intermediate values
- The window starts at
1200x700, is resizable, and requestsMSAA_4X. - The window title is
xxHash3 Visual - First Operation. - The input text is currently hard-coded in src/main.c as
"xxhash3!". - The app is specific to the
XXH3_64bitslen=8path. Other input lengths use different formulas and are not visualized here. - The avalanche page flips bits in the derived
input64value for this path, not arbitrary-length byte strings.