Skip to content

Algorithm

SLH-DSA: hash-based signature construction.

SLH-DSA is the stateless hash-based digital signature algorithm standardized by FIPS 205. This page follows the construction path from one-time signatures and WOTS+ through Merkle authentication, XMSS, FORS, and the SPHINCS+ hypertree.

Introduction: Imperative for Quantum-Resistant Signatures

Hash-based signatures rely on the security of cryptographic hash functions rather than number-theoretic assumptions such as integer factorization or discrete logarithms. This makes them structurally different from RSA, DSA, ECDSA, and BLS-style signatures. Shor's algorithm threatens the latter families directly, while hash functions are mainly affected by Grover's quadratic speedup.

The design lineage begins with one-time signatures. A one-time signature can be built directly from a one-way function, but its key pair must not be reused. Merkle trees, WOTS+, XMSS, and hypertrees are successive mechanisms for turning this disposable primitive into a practical signature system.

This design family is attractive because the security assumption is conservative: the signer and verifier need collision-resistant or preimage-resistant hash functions and carefully separated hash domains, not a structured algebraic problem. The cost is that hash-based signatures tend to have larger signatures and, in the stateful families, strict key-state requirements.

Lamport One-Time Signature Scheme

Lamport OTS signs a fixed-length nn-bit message by generating two random secret values for each message bit. The public key consists of the hash of every secret value.

sk={(ski,0,ski,1)}i=1n,pk={(pki,0,pki,1)}i=1n,pki,b=H(ski,b)sk = \left\{(sk_{i,0}, sk_{i,1})\right\}_{i=1}^{n}, \qquad pk = \left\{(pk_{i,0}, pk_{i,1})\right\}_{i=1}^{n}, \qquad pk_{i,b}=H(sk_{i,b})

Protocol Description

  1. 1.Key generation. Generate two independent secret values for each message bit and publish the hash of every value.
  2. 2.Signing. Read each message bit and reveal the secret value selected by that bit.
  3. 3.Verification. Hash every revealed value and compare the result with the public-key element selected by the same message bit.

To sign a message m=m1m2…mnm=m_1m_2\ldots m_n, the signer reveals one secret value per bit. The verifier hashes each revealed value and compares it with the public-key component selected by the corresponding message bit.

σ=(σ1,…,σn),σi=ski,mi,H(σi)=?pki,mi\sigma=(\sigma_1,\ldots,\sigma_n), \qquad \sigma_i = sk_{i,m_i}, \qquad H(\sigma_i) \stackrel{?}{=} pk_{i,m_i}
Lamport OTS signing selects one secret value for each message bit.
Lamport OTS signing
Lamport OTS verification hashes signature components and compares them with public-key elements.
Lamport OTS verification

Security and Limitations

The security argument is direct: after the public key commits to the secret values through the hash function, forging an unrevealed branch requires finding a preimage of a public hash value. The limitation is equally direct. After one signature, half of the secret key has been revealed. If the same key signs a second message, bit positions where the two messages differ may reveal both branch secrets for the same position.

The original Lamport construction is therefore large and disposable: the public key has size 2nk2nk bits and the signature has size nknk bits for kk-bit secret values.

This one-time restriction is not an implementation detail. It is the core invariant that every later hash-based construction must preserve. WOTS+ makes the one-time signature more compact, and Merkle/XMSS structures make many one-time keys verifiable under one public root, but they do not make an individual OTS key safe for repeated use.

Winternitz OTS

Winternitz OTS reduces the size of Lamport signatures by signing larger base-ww chunks instead of individual bits. The key object is a hash chain.

H0(x)=x,Hj(x)=H(Hj−1(x))for j>0H^0(x)=x, \qquad H^j(x)=H(H^{j-1}(x)) \quad \text{for } j>0

The secret key contains ll random nn-bit seeds. The public key contains the endpoints of ll chains, each of length w−1w-1.

sk=(sk1,…,skl),pk=(pk1,…,pkl),pki=Hw−1(ski)sk=(sk_1,\ldots,sk_l), \qquad pk=(pk_1,\ldots,pk_l), \qquad pk_i=H^{w-1}(sk_i)

Parameters

  • nn. The output length of the underlying hash function.
  • ww. The Winternitz parameter, usually a power of two.
  • ll. The number of chains required for the message chunks plus checksum chunks.

Larger ww values reduce the number of chunks but lengthen the chains. This improves size at the cost of additional hash computations.

W-OTS key generation with hash chains from secret seeds to public key endpoints.
W-OTS key generation

Message Chunks and Checksum

The message digest is converted into base-ww chunks. The checksum records the untraversed chain length for the message part and is also encoded in base ww. Message chunks and checksum chunks form the final codeword bb.

C=∑i=1l1(w−1−mi),b=M∥C,l=l1+l2C=\sum_{i=1}^{l_1}(w-1-m_i), \qquad b=M\parallel C, \qquad l=l_1+l_2
Message digest split into base-w chunks for W-OTS signing.
Base-ww message chunks

To sign the ii-th codeword chunk, the signer reveals the chain value after bib_i hash steps. To verify, the verifier hashes the revealed value forward for the remaining w−1−biw-1-b_i steps.

σi=Hbi(ski),Hw−1−bi(σi)=?pki\sigma_i=H^{b_i}(sk_i), \qquad H^{w-1-b_i}(\sigma_i)\stackrel{?}{=}pk_i

Signing and Verification Mechanics

  1. 1.Convert the message digest into base-ww chunks.
  2. 2.Compute and encode the checksum chunks.
  3. 3.Concatenate message chunks and checksum chunks into the codeword bb.
  4. 4.Reveal one intermediate chain value for every codeword chunk.
  5. 5.Verify by hashing each revealed value forward to the known public endpoint.
W-OTS signature generation using message and checksum chunks.
W-OTS signature generation

Why the Checksum Is Necessary

After seeing an intermediate chain value in a signature, an adversary can compute later values on the same chain. Without a checksum, increasing a chunk value would be easy. The checksum couples all chunks together: increasing a message chunk decreases the checksum, and producing a smaller checksum value would require reversing a hash chain.

The checksum therefore turns a local monotonicity problem into a global consistency condition. A forger can move forward on chains that have already been exposed, but cannot simultaneously adjust the checksum in the opposite direction without solving a preimage problem.

W-OTS+: Modern Refinement for Stronger Security

W-OTS+ keeps the Winternitz structure but replaces plain repeated hashing with a masked chain function. Each chain step is tweaked by a public bitmask, which avoids reusing the same hash behavior at every chain position.

H0(x,r)=x,Hi(x,r)=F(Hi−1(x,r)⊕ri)for i>0H^0(x,r)=x, \qquad H^i(x,r)=F\left(H^{i-1}(x,r)\oplus r_i\right) \quad \text{for } i>0

Verification has the same shape as W-OTS, but the continuation of the chain uses the relevant masks for the remaining positions.

Hw−1−bi(σi,(rbi+1,…,rw−1))=?pkiH^{w-1-b_i}\left(\sigma_i,(r_{b_i+1},\ldots,r_{w-1})\right)\stackrel{?}{=}pk_i
W-OTS+ chain function using XOR with public masks before hashing.
W-OTS+ masked chain function

This is the one-time signature layer used by modern hash-based constructions such as XMSS and SPHINCS+. For SLH-DSA, WOTS+ should be understood as a controlled way to reveal intermediate hash-chain values while still enabling public verification.

The important conceptual change from W-OTS to W-OTS+ is not the high-level signing workflow; it is the security hardening of the chain function. The same message-chunk and checksum logic remains visible, but the hash calls are no longer treated as identical repetitions of one function.

Merkle Signature Scheme (MSS)

One-time signatures are not enough by themselves because a fresh public key would be needed for every message. MSS commits to N=2hN=2^h one-time public keys with one Merkle root. The root becomes the master public key, and each signature includes an authentication path proving that the selected OTS public key is a leaf of the committed tree.

N=2h,Li=H(pkOTS,i),Nodej,k=H(Nodej−1,2k∥Nodej−1,2k+1)N=2^h, \qquad L_i=H(pk_{OTS,i}), \qquad Node_{j,k}=H\left(Node_{j-1,2k}\parallel Node_{j-1,2k+1}\right)

Tree Construction and Key Generation

  1. 1.Choose a tree height hh, giving signing capacity N=2hN=2^h.
  2. 2.Generate NN independent OTS key pairs.
  3. 3.Hash every OTS public key into a leaf value.
  4. 4.Build the binary hash tree bottom-up until only the root remains.
  5. 5.Publish the root as the master public key and keep the OTS secrets plus the next unused index.
MSS key generation with OTS public keys as Merkle tree leaves.
MSS tree construction

To sign with the ss-th OTS key, the signer produces the OTS signature, includes the corresponding OTS public key, and includes the authentication path AuthsAuth_s. The private signing state must then advance.

pkMSS=Nodeh,0,σ=(s,σOTS,pkOTS,s,Auths),s←s+1pk_{MSS}=Node_{h,0}, \qquad \sigma=(s,\sigma_{OTS},pk_{OTS,s},Auth_s), \qquad s\leftarrow s+1
MSS signing with an authentication path from the selected leaf to the Merkle root.
MSS authentication path

Verification

The verifier first checks the OTS signature against the OTS public key at the selected index. It then hashes that OTS public key into a leaf candidate and uses the index plus authentication path to recompute the path to the root. The signature is accepted only if the recomputed root equals the public MSS root.

The authentication path has length hh, one sibling node for each level of the tree. This changes public verification from storing a linear list of OTS public keys to checking a logarithmic proof against a single trusted root.

XMSS: eXtended Merkle Signature Scheme

XMSS refines the classical MSS structure. It uses WOTS+ as the one-time signature scheme and adds address-based randomized hashing so that different hash calls in the construction are separated by context.

The address value records where a hash call occurs: WOTS+ chain, L-tree, main tree, tree height, and node position are not interchangeable. This address separation is part of why XMSS is more than a basic Merkle tree wrapped around WOTS+.

Randomized Hashing and the XOR Tree

A plain Merkle node can be written as P=H(L∥R)P=H(L\parallel R). XMSS instead derives a key and masks from a public seed and address information, then hashes masked children.

Parent=H(K,(Left⊕ML)∥(Right⊕MR))Parent=H\left(K,(Left\oplus M_L)\parallel(Right\oplus M_R)\right)
XMSS Merkle XOR tree unit with keyed hashing and masks.
XMSS randomized tree hashing

Hierarchical Construction: L-Trees and Main Tree

A WOTS+ public key is a vector of many chain endpoints, not a single node. XMSS compresses this vector into one leaf value using an L-tree. Those compressed leaves are then used in the main XMSS tree.

L-tree compresses WOTS+ public-key elements into one leaf.
L-tree compression
L-trees produce leaves for the main XMSS Merkle XOR tree.
L-trees inside the XMSS main tree

XMSS Protocol Description

XMSS derives WOTS+ private-key material from a seed rather than storing every OTS secret key explicitly. Its public key and secret key have the following conceptual form.

pkXMSS=(Root,Pseed),skXMSS=(idx,Sseed,SKPRF,Pseed,Root)pk_{XMSS}=(Root,P_{seed}), \qquad sk_{XMSS}=(idx,S_{seed},SK_{PRF},P_{seed},Root)

Key Generation

  1. 1.Sample the WOTS+ derivation seed, the PRF key for per-signature randomness, and the public seed.
  2. 2.Derive WOTS+ secret material pseudorandomly for every leaf index.
  3. 3.Generate each WOTS+ public key and compress it into a leaf.
  4. 4.Build the main XMSS tree using address-derived keys and masks.
  5. 5.Publish the root and public seed; store the index and secret seeds in the private key.

Signing snapshots the current index, advances the state, derives a per-signature randomizer, hashes the message with context, signs the resulting digest with WOTS+, and includes the authentication path.

idxsig←idx,idx←idxsig+1,r=PRF(SKPRF,idxsig)idx_{sig}\leftarrow idx, \qquad idx\leftarrow idx_{sig}+1, \qquad r=PRF(SK_{PRF},idx_{sig})
M′=Hmsg(r∥Root∥idxsig,M),σ=(idxsig,r,σOTS,Authidxsig)M'=H_{msg}(r\parallel Root\parallel idx_{sig},M), \qquad \sigma=(idx_{sig},r,\sigma_{OTS},Auth_{idx_{sig}})

Verification reconstructs the WOTS+ public key from the signature and message digest, compresses it into a leaf, recomputes the root using the authentication path, and checks that the resulting root equals the public root.

Verification

  1. 1.Recompute the randomized message digest from the message, randomizer, root, and signing index.
  2. 2.Reconstruct the WOTS+ public key from the WOTS+ signature and digest.
  3. 3.Compress the reconstructed WOTS+ public key into a leaf value.
  4. 4.Use the authentication path to recompute the candidate root.
  5. 5.Accept only if the candidate root equals the root in the XMSS public key.

Scaling Up: XMSS^MT Hyper-tree

A single XMSS tree with very large height gives many signing leaves, but key generation and maintenance become expensive. XMSS^MT stacks smaller trees. The top root is the master public key; lower-layer tree roots are signed by trees in the layer above; the bottom layer signs the message-level object.

Tree-of-Trees Architecture

  • Top layer. A single tree whose root is the public key.
  • Middle layers. Trees whose roots are signed by leaves in the layer above.
  • Bottom layer. The layer that signs the message-level object.
XMSS^MT hypertree with top, middle, and bottom layers.
XMSS^MT hypertree

This layered idea is one of the important bridges toward SPHINCS+ and SLH-DSA. The exact stateless SLH-DSA construction adds FORS and message-dependent indexing, but the root-chaining intuition is already visible in the XMSS^MT hypertree.

The trade-off is explicit: smaller trees reduce key-generation latency and signing cost, while the final signature grows because it carries reduced signatures and authentication paths for multiple layers.

State Liability

MSS and XMSS are stateful. The signer must persist the next unused leaf index and must never reuse a WOTS+ key pair. If a wallet or validator restores from an old backup and signs again with a reused index, the one-time security assumption can fail.

This is the main conceptual reason to continue from XMSS to SPHINCS+ and SLH-DSA. SLH-DSA keeps the hash-based foundation but removes the requirement that the signer maintain a fragile monotonic OTS index.

In controlled environments, such as consensus signing systems with crash-safe monotonic counters, stateful hash-based signatures can be operationally plausible. In ordinary wallet workflows, backup and restore semantics make that guarantee much harder to enforce.

FORS: Forest of Random Subsets

Once the persistent XMSS signing index is removed, the bottom of the construction needs a different way to bind a message to the hash-tree structure. FORS, the Forest of Random Subsets, fills that role in SPHINCS+. It is a few-time signature component: it does not replace the full signature scheme, but it turns a message digest into several selected leaves across several small trees.

At a high level, the message is first hashed together with signing randomness and public context to produce a digest mdmd. The digest is interpreted as kk indices, one for each tree in the FORS forest.

md→(i0,i1,…,ik−1),0≤ij<2amd \rightarrow (i_0,i_1,\ldots,i_{k-1}), \qquad 0 \leq i_j < 2^a

If each tree has height aa, each tree contains 2a2^a leaves. The signer reveals the secret value at the selected leaf in each tree, together with the authentication path from that leaf to the corresponding root. Conceptually, the FORS signature has the following shape.

σFORS=((sk0,i0,Auth0,i0),…,(skk−1,ik−1,Authk−1,ik−1))\sigma_{\mathrm{FORS}} = \left((sk_{0,i_0},Auth_{0,i_0}),\ldots,(sk_{k-1,i_{k-1}},Auth_{k-1,i_{k-1}})\right)
FORS opens selected leaves across a forest and compresses the roots into pk_FORS.
FORS forest openings

Reconstructing the FORS public value pkFORSpk_{\mathrm{FORS}}

The verifier recomputes the message digest and derives the same index sequence. For each selected leaf, the verifier hashes the revealed secret value to reconstruct a leaf candidate, then uses the authentication path to recompute that small tree's root.

After all kk trees have been checked, the verifier has a list of roots. These roots are compressed into a single FORS public value.

pkFORS=H(Root0∥Root1∥⋯∥Rootk−1)pk_{\mathrm{FORS}} = H\left(Root_0\parallel Root_1\parallel\cdots\parallel Root_{k-1}\right)

This notation is intentionally simplified. A concrete implementation domain-separates these hash calls and parameterizes them with addresses, seeds, and function-specific inputs. The structural point is that FORS converts a message-dependent set of forest openings into a compact value, pk_FORS, that can be authenticated by the layers above it.

From FORS to the SPHINCS+ Hypertree

FORS proves something local: for the randomized message digest, the signer opened the right leaves in the FORS forest and provided valid paths to the corresponding roots. But pk_FORS is not itself the long-term public key. The verifier still needs a path from this message-dependent value to the global public root.

SPHINCS+ closes that gap with a hypertree. The construction stacks XMSS-like trees. A WOTS+ key in one layer signs the value from the layer below, and a Merkle authentication path lifts the verifier from that WOTS+ public key to the current tree root. Repeating this step carries the verifier up to the top root.

Deriving the Tree Position

SPHINCS+ does not keep an XMSS-style signing counter. Instead, each signature derives the relevant tree position from the message, a per-signature randomizer RR, and public-key context.

Hmsg(R,PK.seed,PK.root,M)→(md,idxtree,idxleaf)H_{msg}(R,PK.seed,PK.root,M)\rightarrow(md,idx_{tree},idx_{leaf})

The digest mdmd is passed to FORS. The other outputs, idx_tree and idx_leaf, identify where the resulting pk_FORS is attached in the hypertree: roughly, which bottom-layer tree is used and which WOTS+ leaf inside that tree signs the FORS public value.

One Hypertree Layer

At the bottom layer, the value from below is pk_FORS. A WOTS+ key signs that value.

σWOTS(0)=WOTS.Sign(skWOTS(0),pkFORS)\sigma_{\mathrm{WOTS}}^{(0)} = \mathrm{WOTS.Sign}\left(sk_{\mathrm{WOTS}}^{(0)},pk_{\mathrm{FORS}}\right)

The verifier reconstructs the WOTS+ public key from the WOTS+ signature and the signed value. That WOTS+ public key is then compressed into a Merkle-tree leaf, and the authentication path recomputes the root of the current tree.

Layer Step

  1. 1.WOTS+ signs the value received from the layer below.
  2. 2.The verifier reconstructs the WOTS+ public key from the signature.
  3. 3.The WOTS+ public key becomes a leaf of the current Merkle tree.
  4. 4.The authentication path lifts the verifier from that leaf to the tree root.

Repeating the Climb

Once the verifier reaches the root of the bottom tree, that root becomes the value signed in the next layer. The same WOTS+ plus authentication-path step repeats until the verifier reaches the top of the hypertree.

σ=(R,σFORS,σHT)\sigma=(R,\sigma_{\mathrm{FORS}},\sigma_{\mathrm{HT}})
σHT=((σWOTS(0),Auth(0)),…,(σWOTS(d−1),Auth(d−1)))\sigma_{\mathrm{HT}} = \left((\sigma_{\mathrm{WOTS}}^{(0)},Auth^{(0)}),\ldots, (\sigma_{\mathrm{WOTS}}^{(d-1)},Auth^{(d-1)})\right)
SPHINCS+ hypertree authenticates the FORS output up to the public root.
SPHINCS+ hypertree

Verification is therefore a climb. The verifier reconstructs pk_FORS, verifies the bottom WOTS+ signature on that value, uses the authentication path to compute the bottom tree root, and then treats that root as the value authenticated in the next layer. The signature is valid only if the final computed root equals the public root.

Construction Summary

The move from XMSS to SPHINCS+ is not a rejection of the earlier hash-based machinery. WOTS+ signatures, Merkle authentication paths, and layered tree roots remain central. The change is operational: instead of consuming leaves through a persistent signing state, SPHINCS+ derives the relevant position from the signing context and carries the necessary path material inside the signature.

In this view, FORS handles the message-dependent bottom value, and the hypertree authenticates that value up to the long-term public root. FIPS 205 standardizes the SPHINCS+-based construction as SLH-DSA, but the standard-specific object formats and interfaces are separate from the construction-level flow described here.

Primary References

  • RFC 8391: XMSS: eXtended Merkle Signature Scheme
  • Leslie Lamport, Constructing Digital Signatures from a One Way Function
  • Andreas Huelsing, W-OTS+ - Shorter Signatures for Hash-Based Signature Schemes
  • SPHINCS+ project and specification materials