Monday, November 30, 2026

Hunting for Zero: Solving FNV Zero-Hash Challenges with Lattice Reduction

FNV (Fowler–Noll–Vo) is one of the most widely used non-cryptographic hash functions. It is simple, fast and found almost everywhere, from hash tables to DNS servers to file systems. For many years its maintainer, Landon Curt Noll, has hosted a list of 72 "zero-hash challenges" on the FNV page:

What is the shortest data set for which the n-bit FNV-1 (or FNV-1a) hash is 0?

The challenges vary three things:

  • the hash width: 32, 64, 128, 256, 512 or 1024 bits
  • the variant: FNV-1 multiplies and then XORs, FNV-1a XORs and then multiplies
  • the alphabet: arbitrary binary data, runs of NUL or 0xff octets, non-NUL ASCII, printable ASCII or alphanumeric characters

The 32- and 64-bit challenges were solved years ago. Most of the 128- and 256-bit challenges, however, had been open since around 2011. Over the past weeks I worked on them, and my results are now published on the FNV page.

Why brute force is hopeless

For example, the shortest alphanumeric string with a 128-bit FNV-1a hash of 0 turns out to have 22 characters. Trying all such strings means 63^22 ≈ 2^131 hash evaluations. A meet-in-the-middle attack would still need on the order of 2^64 memory. A different approach is needed.

The key idea: turning a hash into a linear problem

FNV processes one octet at a time:

FNV-1a:  h = (h XOR c) * P   mod 2^n

The XOR is what makes this nonlinear. But if every character c is smaller than 128, the XOR only touches the lowest 7 bits of the state. Two small helper values make the recurrence exact and linear:

  • u_i: the low 7 bits after the XOR
  • r_i: the low 7 bits after the multiplication (r_i = 59 · u_i mod 128, since 59 = P mod 128)

Then the recurrence can be written as

G_i = (G_(i-1) + u_i) · P − r_i   (mod 2^n)

where G_i is the state without its low bits. The hash is 0 if and only if a modular knapsack with small unknowns (0 ≤ u, r ≤ 127) has a solution. That is a closest-vector problem in a lattice, and lattices are something we have good tools for:

  1. Reduce the lattice once. Exact integer LLL followed by BKZ-20. For a fixed string prefix, only the target vector changes, not the lattice.
  2. Enumerate. Schnorr–Euchner enumeration lists every lattice point in a ball around the centre of the cube of admissible values.
  3. Translate back. Each lattice point becomes a candidate string. It is kept only if every character is in the alphabet and the real hash, recomputed independently, is 0.

The enumeration can run in two modes:

  • Exhaustive: the ball contains the whole cube and nothing is pruned. Every solution of a given length is guaranteed to be found, which is what proves that no shorter solution exists.
  • Pruned ("extreme pruning"): several randomized rounds that each cover most of the cube. The fraction actually covered can be measured, which gives a rigorous residual probability for "there is no shorter solution".

For arbitrary binary data, the same idea works with an 8-bit linearization. For very short lengths, where the lattice is too small for reduction to work, a separate meet-in-the-middle program in Python takes over. It shares no code with the lattice search.

Runs of 0xff: an exact answer via 2-adic lifting

The challenges about runs of consecutive 0xff octets need a different technique. Here a single step f(h) = (h XOR 0xff) · P is a bijection modulo 2^n. So the orbit of the offset basis is one single cycle, and the answer is unique below the cycle length.

256 consecutive steps form an affine map, which can be raised to huge powers by repeated squaring. The exact length is then lifted bit by bit, modulo 2^j for j = 8, 9, …, n. Nothing is sampled, so the result is exact, even for lengths around 10^300.

Results

Solved: shortest length proven (13 challenges)

ChallengeWhatResult
#3binary, 128-bit FNV-1length 16; the only solution of this length (the previous best had 17)
#9binary, 128-bit FNV-1athe first solutions ever: all 251 solutions of length 17
#39 / #45non-NUL ASCII, 128-bit FNV-1 / FNV-1alength 19; all 28 and all 30 solutions
#51 / #57printable ASCII, 128-bit FNV-1 / FNV-1alength 20; 5 and 10 solutions
#270xff run, 128-bit FNV-1the published length did not give hash 0; the correct length is 51139138437908895582755236659575676289, the only one below 2^128
#30, #32–#360xff runs, 64 to 1024 bitsproved that the known lengths are the shortest (unique below the cycle length)

Best known, not yet proven shortest (6 challenges)

ChallengeWhatResult
#4 / #10binary, 256-bit FNV-1 / FNV-1alength 32 (previous best 38 / first solution); a shorter one exists with probability < 1.4 · 10^-7
#40 / #46non-NUL ASCII, 256-bit FNV-1 / FNV-1alength 37; 7 and 5 solutions
#63 / #69alphanumeric, 128-bit FNV-1 / FNV-1alength 22; 5 and 10 solutions; length 21 covered to about 98 %, residual probability ≈ 0.3 %

Confirmed (5 challenges)

For the 64-bit entries #44, #50, #56, #62 and #68, Rudi Cilibrasi wrote in 2014 that he believed there were no other solutions of the same or shorter length. An exhaustive search now confirms this: there is no shorter solution, and the published solutions are exactly all solutions of their length.

Along the way, I also noticed that a published 256-bit solution from 2011 (#4) only works with a trailing newline octet (0x0A). It had most likely been lost when the solution was first published.

How do I know the program is right?

A search program that claims "there is no shorter solution" has to earn some trust. I checked it in four ways:

  • Known results: run exhaustively, the lattice search reproduces exactly the published 32- and 64-bit results (challenges 37, 38, 43, 49, 50, 55, 56, 61, 62, 67 and 68), including "no solution of the next shorter length".
  • Independent code: the meet-in-the-middle program shares no code with the lattice search and reproduces the 32-bit results.
  • Independent verification: every single solution was verified twice, with the FNV implementation of Jacksum, my open-source checksum tool, and with a short arbitrary-precision Python implementation.
  • Plausibility: the counting argument (alphabet size^n / 2^bits expected solutions) agrees with what was found. For example, about 27.6 solutions are expected for non-NUL ASCII of length 19, and 28 and 30 were found.

What's left

The 512- and 1024-bit challenges remain out of reach with this method. So do the printable and alphanumeric challenges at 256 bits: the alphabet filter costs about a factor of two per character, which adds up to an estimated 77 days per search round. Proving that 22 is the shortest length for the 128-bit alphanumeric challenges would take an exhaustive search that is not practical today.

Many thanks to Landon Curt Noll for maintaining the FNV page for so many years, and for publishing and correcting the results so quickly.

🔗 FNV page with all challenges: https://www.isthe.com/chongo/tech/comp/fnv/ 
🔗 Jacksum: https://github.com/jonelo/jacksum

No comments: