2 min
🌀 Spiral Burst 128
SB128: a deterministic “data-bearing snowflake” that pairs a central Data Matrix with six spiral arms
đź”—SB128 - Spiral Burst 128
SB128 is a deterministic “data-bearing snowflake” that pairs a central Data Matrix with six spiral arms. Each arm carries 64 bands; a simple burst mark encodes a bit (bright disk + tiny diamonds) and a faint dot marks zero, so the arms stay visible even in monochrome. A 128‑bit SF128 identifier is encoded three times (repetition code), plus a CRC16 in the Data Matrix for cross‑checks.
🔗What’s inside
- Payload: user string.
- SF128: first 16 bytes of SHA‑256(payload).
- CRC16: CRC‑16/CCITT of the SF128 bytes.
- Data Matrix (center): payload, SF128 (hex), CRC16 (hex), using the smallest fitting ECC200 symbol.
- Arms: 6 arms Ă— 64 bands = 384 bits, carrying 3Ă—SF128 (majority vote per bit).
đź”—Encoding geometry
- Image: 1152Ă—1152 px, radial gradient background.
- Arms: Archimedean spirals, inner radius 0.25 (norm to corner), outer 0.70, mild twist.
- Band mark (bit=1): bright disk with dark outline and four micro‑diamonds along ±tangent/±perp.
- Band mark (bit=0): faint dot only.
- No randomness; positions are fixed per (arm, band).
đź”—Decoding approach
- Recompute (arm, band) positions from image size and shared constants.
- Sample a small luma patch at each band center to get an energy value.
- Otsu split → threshold = μ0 + 0.55·(μ1–μ0); classify energies to bits.
- Majority vote each bit across the 3 repetitions → SF128; compute CRC16.
- Optionally decode the central Data Matrix and cross‑check SF128/CRC16.
- Optional
--searchtries small rotate/scale/translate transforms if needed.
đź”—CLI usage
- Encode:
python encode_snowflake.py "Your payload"(add--verifyto arm‑decode after render). - Decode:
python decode_snowflake.py snowflake.png --search(or without--searchfor speed). - Robustness smoke (blur/rot/scale/noise, optional search):
python robustness_test.py.
đź”—Constraints & robustness
- Works in grayscale/black‑and‑white; outlines and burst contrast survive binarization.
- Repetition code tolerates isolated bit errors; CRC16 covers SF128.
- Keep central DMX mostly unobstructed; extreme occlusion of multiple arms will break recovery.
đź”—Example
A walk‑through and sample render are available here: /posts/sb128/

đź”—Files
encode_snowflake.py— SB128 encoder (PNG output).decode_snowflake.py— SB128 decoder (arms, optional DMX cross‑check).robustness_test.py— quick perturbation tests.***