npxio/ lattice

LATTICE LAB · LATTICE-4

⚠ Experimental ciphers designed in-house and not reviewed by cryptographers. For learning and attack research only. Never use it to protect real messages.

Encrypt / decrypt

Avalanche: flip one key bit

Same message, same nonce, one key bit flipped. Lit squares are output bits that changed. A strong cipher changes about half of them, scattered with no pattern.
of the first block's 512 bits changed

Tamper-proof mode (LATTICE-Poly1305)

Encrypts the message above and adds a 16-byte Poly1305 tag. Any change to the ciphertext or the sender label is rejected. Poly1305 is the standard MAC from ChaCha20-Poly1305 (RFC 8439), not our invention.

Diffusion by round (live, in your browser)

For each round count: flip one random input bit across many random states and record the worst-biased output bit. Red bars: an attacker can detect a pattern. Amber: no pattern found at this precision.

Attack scoreboard

From the offline attack suites. Brute force on the 256-bit key costs 2^256. Read the LATTICE-4 spec, every attack we ran and the test vectors.
Best attack (C tools)LATTICE-1 (12r)LATTICE-2 (20r)LATTICE-3 (20r)LATTICE-4 (20r)
Round-3 cracks, 1M pairs/bithundreds691080 (even at 8M)
Key recovery, 4 rounds≈ 2^77≈ 2^129≈ 2^98≈ 2^145
Key recovery, 5 rounds≈ 2^136≈ 2^135≈ 2^135≈ 2^175
Key recovery, 6 rounds≈ 2^247≈ 2^250≈ 2^235held
New classes: diff-linear, 2-bit, related-key (3r)——diff-linear heldall held
Rounds broken / margin6 of 12 · 2x6 of 20 · 3.3x6 of 20 · 3.3x5 of 20 · 4x

LATTICE-1 attack details

AttackRounds brokenNotes
Key recovery + neutral bits5 (6 marginal)first estimates: 5 rounds ≈ 2^140, 6 rounds ≈ 2^248
Key recovery, 4 rounds4true key ranked #1 of 65,536; first estimate 2^144, improved combined attack ≈ 2^77
Full differential scan3counter/nonce bit 24 gives ~6% bias (17 sd)
Cube (algebraic)2cubes up to 2^16 counter values
Rotational1diagonal constants stop it at round 2
Linear correlation0no input-output correlation at any round tested
Slide / self-similarity0constants never reappear
Nonce reusetotalbreaks every stream cipher; the app must never reuse a nonce