← Back to section · Post-Quantum Cryptography
What Hash-Based Signatures Ask of a Hash Function: Preimages, Second Preimages and Multi-Target Attacks
Which properties of a hash function hash-based signatures actually need: preimage resistance as the foundation, the division of labor between second-preimage and collision resistance, Grover's real impact, and why multi-target attacks change the parameter arithmetic.
Hash-based signatures are often summarized in one sentence: “they rely only on the security of a hash function.” True, but too coarse — the “security” of a hash function is not one thing but a bundle of properties: preimage resistance, second-preimage resistance, collision resistance, and more, with different positions in a signature scheme depending on different members of the bundle. Unbundling them explains why quantum attacks only discount these schemes, why parameter tables carry seemingly wasteful margins, and why XMSS and SPHINCS+ attach addresses and “tweaks” to their hash calls.
Preimage resistance: the family’s foundation
Given an output y, find any x with H(x) = y — that is the preimage problem. For an ideal hash with n-bit output, the classical attack is brute force at about 2^n work; Grover’s algorithm reduces quantum brute force to about 2^(n/2). Forging a Lamport signature, walking a Winternitz chain backward, impersonating a one-time public key — every basic forgery move lands exactly on this problem. This is the source of the family’s confidence: its core assumption is singular, studied for decades, and quantum algorithms accelerate it only by a square root. Choose a 256-bit output and the quantum preimage strength is still around 128 bits — enough. Hash-based signatures therefore do not need a new primitive for the quantum era; they need their sizes computed honestly.
Adjacent to preimage resistance is second-preimage resistance: given x and H(x), find a different x’ with H(x’) = H(x). It matters just as much in signatures: an attacker who has seen a signed message and its signature, and wants a second message that fits the same signature, needs a second preimage or a variant of one. For an ideal n-bit hash, the classical and quantum pictures for second preimages are broadly on par with those for preimages. The masking design of WOTS+ and the randomized message hashing of SPHINCS+ are both about pulling a scheme’s security back onto these two “one-way” properties rather than anything stronger.
Collision resistance: the Merkle tree’s position
Collision is the stronger property: find any two distinct inputs with the same hash. The birthday attack caps classical collision strength of an n-bit hash at 2^(n/2), and quantum collision algorithms press it a bit lower. In hash-based signatures, collisions matter mainly at the tree’s binding step: if an attacker can produce a collision pair for some leaf position, they may be able to slip a one-time public key of their own under an already published root. Internal tree hashing therefore usually asks for collision resistance — or reduces the dependence on it through domain separation and compression choices. XMSS’s extra independent hash of each leaf before it enters the tree, and SPHINCS+‘s tweakable hashes scattering calls by position and type, are both managing exactly this layer.
A point of frequent confusion: lower collision strength does not mean the whole signature is only that strong. The main forgery paths run through preimages and second preimages; collisions affect specific substitution attacks. Parameter design aims to make the weakest relevant link sufficient — not to be frightened, or lulled, by any single number. Honest evaluation also keeps two separate ledgers, classical and quantum: against a classical adversary, preimage strength counts at the full output length and collisions at half of it; against a quantum adversary, Grover cuts preimages to the square-root scale and collisions have their own dedicated quantum algorithms. Parameters are honest only if they clear the line in both ledgers — which is why a 256-bit output has become the family’s de facto starting size: it leaves an acceptable margin in all four combinations (classical/quantum × preimage/collision).
Multi-target attacks: quantity dilutes strength
In real deployments an attacker never faces a single target. A Merkle tree holds a million one-time public keys; every chain offers hundreds or thousands of intermediate values — breaking any one of them may be useful. Running a preimage search against T targets at once cuts the expected cost of breaking “any one of them” by a factor of about T (the quantum picture dilutes by target count as well). So security bits computed for the single-target case must first pay a discount of log2(T) bits in front of a large tree. In a height-20 system the target count is in the millions and the discount is on the order of 20 bits — parameters that ignore it are advertising strength they do not have.
Standards counter this on two levels. First, parameter margins: output lengths and chain parameters are calibrated to the multi-target picture, not the single-target one. Second, structural isolation: XMSS’s addresses and SPHINCS+‘s tweakable hashes inject a different tweak parameter into the hash call at every position and for every purpose, so work done against one position cannot be amortized across all of them — effectively decomposing the multi-target problem back into single-target ones. This is why hash calls in modern hash-based signatures look so much more elaborate than the textbook versions: every extra XOR and concatenation is plugging a specific amortization channel.
When it comes to choosing the function, the standards’ menu is short: the stateful side (the XMSS/LMS parameters covered by SP 800-208) centers on SHA-256 and SHAKE, while FIPS 205 lists two parameter families for SLH-DSA, based on SHA-2 and on SHAKE. The brevity of the menu is itself a statement: hash-based signatures need no exotic primitive, only the few most thoroughly analyzed functions, with room left to switch between them — if one function is ever weakened, the whole family can migrate to another without changing the structure of any scheme. This replaceability of the primitive is a resilience unique to the hash route: RSA cannot “swap out” factoring, and lattice signatures cannot swap out lattice problems, but the foundation of a hash-based signature is a brick that can be replaced as a whole.
Closing
The requirements hash-based signatures place on a hash function form a checklist: preimage resistance as the root, second-preimage resistance as the beams, collision resistance guarding the tree’s binding, and the multi-target picture deciding how much margin parameters must carry and how much isolation structure must provide. Read with this checklist in hand, the “conservative” numbers in the family’s parameter tables stop looking like waste — they are the full cost of keeping the promise “hash functions only” in front of a quantum adversary with a million targets to choose from.
Tags: hash functionspreimage resistancemulti-target attacksGrover