When a bank signs the firmware of a payment terminal, or a vendor signs a bootloader that will run for fifteen years, the key must stay trustworthy for a very long time. A hash-based signature is the most conservative answer. It needs nothing more than a hash function, which is the best-understood primitive in cryptography.
This article builds the idea from Leslie Lamport's original one-time signature up to the standards in use today. It also explains the one operational hazard, state reuse, which decides where these schemes can safely be used. For the wider set of standards see The NIST post-quantum standards.
Why hash functions are enough
A hash function turns any input into a fixed-size fingerprint and cannot practically be run backwards. Shor's algorithm does not apply to it. The best known quantum attack on a hash function is Grover's search, which gives only a square-root speed-up, so a hash with a long enough output stays strong.[6]Doubling the output length restores the margin.
A signature scheme built from a hash needs no further assumption. If the hash is secure, the signature is secure. Lattice schemes depend on newer problems that have had less time under attack. The trade is that hash signatures are large, and some must be handled with care.
Lamport one-time signatures
Leslie Lamport described the first hash-based signature in 1979.[4] It signs a message once, and only once. To sign a 256-bit message digest, the signer makes 256 pairs of random secrets. The public key is the hash of every secret. To sign, the signer looks at each bit of the digest and reveals one secret from the matching pair: the first if the bit is 0, the second if it is 1. The verifier hashes each revealed secret and compares it with the public key.
A small example
Suppose the digest has just three bits, and the signer holds three pairs of secrets, (a0, a1), (b0, b1) and (c0, c1). The public key is the six hashes H(a0), H(a1), H(b0), H(b1), H(c0), H(c1). To sign the bits 1, 0, 1, the signer reveals a1, b0 and c1. The verifier checks that H(a1), H(b0) and H(c1) match the right public entries. The unrevealed secrets a0, b1 and c0 stay hidden.
One signature reveals exactly one secret from each pair (gold). Anyone can hash them and compare with the public key, but nobody learns the other half.
For a real 256-bit digest and 32-byte secrets, the signature holds 256 secrets, which is 8,192 bytes. The private key is 512 secrets, or 16,384 bytes. The scheme is secure only for one signature. A second signature on a different message reveals secrets from the other half of some pairs, and an attacker can then mix and match revealed secrets to sign messages of their own choice.
Winternitz chains
Lamport signatures are large. The Winternitz idea shrinks them by trading size for computation. Instead of revealing one secret per bit, the signer hashes a secret repeatedly to form a chain. The public key is the end of the chain, after a fixed number of hashes. To sign a number, the signer reveals the point in the chain that sits that many steps from the start. The verifier hashes the remaining steps and compares the result with the public key.
With a Winternitz parameter of 16, one chain signs four bits, so 256 bits need 64 chains. A short checksum chain is also needed, because without it an attacker could move signatures forward along the chain to forge a larger value. The variant used in modern standards is called WOTS+. The standards use it as the building block under the Merkle trees described next.[1][2]
Merkle trees
A one-time key signs only one message, which is no use for a certificate authority or a firmware pipeline. Ralph Merkle solved this in 1979.[5] Generate many one-time keys, for example 1,024 of them, and hash the public keys together in pairs, then hash those results in pairs, and continue until a single value remains. That value, the root, is the public key. It never changes.
To sign, the signer uses the next unused one-time key, then attaches the sibling hashes along the path from that leaf to the root. The verifier checks the one-time signature, rebuilds the root from the leaf and the path, and compares it with the public key. A tree of height h gives 2 to the power h signatures, and the signature carries h extra hashes.
A tree of four leaves
Take four one-time public keys, K0 to K3. Hash them in pairs to get H01 = H(K0, K1) and H23 = H(K2, K3), then hash those to get the root R = H(H01, H23). To sign with the third key, K2, the signer sends the one-time signature, the key K3 and the hash H01. The verifier recomputes H23 from K2 and K3, then R from H01 and H23, and checks that R equals the published public key. The signature carries two extra hashes because the tree has height two.
Stateful schemes: LMS and XMSS
LMS and XMSS apply the Merkle structure directly. NIST approved both in SP 800-208 in October 2020, along with their multi-tree variants, HSS and XMSS^MT, which stack trees to allow more signatures.[1]Both are well understood and their security proofs depend only on hash properties.
The signer must keep a state: a counter that records which one-time key is next. Each signature uses one leaf, and the counter must advance and be saved before the signature leaves the device. If the same leaf signs two different messages, the one-time property fails. An attacker who sees both signatures learns enough secrets to forge further signatures under the public key.
Why reuse is catastrophic
A forged signature from a spent key is indistinguishable from a real one. Nobody can tell that it was forged, and revoking the key means replacing the root of trust in every device that holds it.
- Backups and restores. Restoring a signing server from a backup rewinds the counter, and the next signature may reuse a leaf.
- Virtual machine snapshots and cloning. Two copies of the same machine both sign from the same counter value.
- Failover. Two signers in a high-availability pair can sign at once.
- Crashes. A signer that signs and then fails before saving its counter will reuse the leaf after restart.
SP 800-208 therefore expects the key and its state to live and stay inside a hardware cryptographic module. The module must never export the private key, must not be cloned, and must update the state before releasing a signature.[1] A signing key on an ordinary file server does not meet that bar.
SLH-DSA: the stateless scheme
SLH-DSA, specified in FIPS 205 and derived from SPHINCS+, removes the state requirement.[2]The idea is to make the tree so large that the signer can pick a leaf at random without ever picking the same one twice in practice. The standard is designed for a very large signature count per key, up to 2 to the power 64.[2]
A tree with that many leaves cannot be built in advance, so SLH-DSA uses two devices.
- A hypertree. Trees are stacked in layers. The top tree signs the roots of trees in the layer below, and so on, down to the bottom layer. Only the trees along the chosen path are ever computed.
- Few-time signatures. The bottom layer signs the message with a few-time scheme, which tolerates a small number of accidental reuses. A random leaf collision therefore does no harm.
The result has no counter to track, so backups, cloning and failover cannot break it. It is still expensive. The signature carries the few-time signature and one authentication path for each layer of the hypertree.
The small and fast variants
Each security level comes in two forms. The “s” variants have smaller signatures and are slower to sign. The “f” variants sign faster and produce larger signatures. SLH-DSA-SHA2-128s signs with a 7,856-byte signature, while SLH-DSA-SHA2-128f needs 17,088 bytes. At category 5, SLH-DSA-SHA2-256s uses 29,792 bytes.[2] The standard also offers SHAKE-based variants alongside the SHA-2 ones.
Sizes and speed
| Scheme | State | Public key | Signature | Signing | Verification |
|---|---|---|---|---|---|
| LMS / XMSS | Must be tracked | Small, tens of bytes | From about one to a few kilobytes, depending on parameters | Fast per signature; key generation is slow for large trees | Fast |
| SLH-DSA-SHA2-128s | None | 32 | 7,856 | Slow | Fast |
| SLH-DSA-SHA2-128f | None | 32 | 17,088 | Faster than 128s | Fast |
| SLH-DSA-SHA2-256s | None | 64 | 29,792 | Slow | Fast |
| ML-DSA-65 (for comparison) | None | 1,952 | 3,309 | Fast | Fast |
| ECDSA P-256 (for comparison) | None | 64 | about 64 to 72 | Fast | Fast |
Exact LMS and XMSS sizes depend on tree height and Winternitz parameter, so check SP 800-208 and your library before you plan capacity.[1] SLH-DSA sizes are from FIPS 205.[2]Speed labels here are qualitative. Measure on your own hardware, because SLH-DSA signing cost varies widely between devices and implementations.
Where hash-based signatures fit
These schemes suit keys that sign rarely, whose signatures can afford a few kilobytes, and whose trust must last for decades.
- Firmware and boot signing. A manufacturer signs a few releases a year in a controlled build environment, and devices only verify. Verification is fast and the public key is tiny, which suits boot ROM. A bank's ATM, card terminal or HSM vendor is in this position.
- Root certificate authorities. A root signs few certificates, often only the intermediates, and must stay valid for twenty years or more. A hash-based root needs few security assumptions.
- Long-term archives. Signed records that must remain verifiable for decades, such as mortgage files or regulatory filings, benefit from a signature whose security does not depend on a newer mathematical problem.
They fit poorly for high-volume signing such as TLS handshakes, JWTs or document workflows, where ML-DSA is the practical choice.
Choosing between stateful and stateless
The choice is mostly an operational one, not a cryptographic one. LMS and XMSS give smaller signatures and faster signing, and they are the schemes CNSA 2.0 names for firmware.[3] They are a good fit when a small number of people sign in a controlled facility, with a hardware module that enforces the counter, and where the number of signatures over the key's life can be bounded in advance. A firmware release pipeline that signs a few hundred images a year fits that description.
SLH-DSA suits the opposite situation. If keys will be copied for resilience, if signing runs on cloud infrastructure that may be snapshotted or restored, or if nobody can promise perfect state discipline for twenty years, the larger signature is a fair price for removing the risk. The stateful schemes also demand planning at key-generation time, because the tree height fixes the signature count. Underestimating it forces a new root of trust before the key was meant to expire.
Both families share one useful property. A verifier needs only a hash function, so verification code is small and easy to audit. That matters in boot ROM and in other places where code space is tight and cannot be patched once the device has shipped.
What to do now
- List every signing key that protects firmware, boot chains, root CAs and archives. These are your candidates for hash-based signatures.
- For stateful schemes, require a hardware module that manages state, and write the restore, cloning and failover rules before the first key is generated.
- Where state management is not possible, use SLH-DSA and budget for larger signatures.
- Run
qsc scanover build pipelines, signing configuration and certificates to find RSA and ECDSA signing, then useqsc fixand the CBOM output to track what moves to a quantum-safe signature. - Ask hardware and firmware vendors which of LMS, XMSS and SLH-DSA they verify in their boot ROM, because a device that cannot verify them cannot accept updates signed with them.
Related reading. The NIST post-quantum standards, Lattice cryptography, explained, Choosing post-quantum algorithms and Grover's algorithm and symmetric cryptography.