8. Signatures from hashes
Draft
The most conservative assumption: a hash function
The signatures of Section 7 rest on structured lattices, just as classical signatures rest on factoring and discrete logarithms. Yet a digital signature can be built from a much narrower assumption: a cryptographic hash function, fast to evaluate forward and with no known shortcut for running it backward. Generate secret strings, publish their hashes as the public key, and sign a message by revealing whichever subset of secrets its bits select. In that raw form a single signature exposes half of the private key, so each key can safely sign only once. Three structural upgrades turn that one-time toy into a practical standard: hash chains, so that a single secret encodes four bits instead of one; a hash tree, so that one 32-byte root authenticates millions of one-time keys; and a tree of trees so vast that the signer can pick a leaf by hashing the message instead of maintaining a counter. That final construction is SLH-DSA, the Stateless Hash-Based Digital Signature Algorithm (SPHINCS+), published by the United States National Institute of Standards and Technology (NIST) as FIPS 205.
Changing a single character in an input scrambles the output of SHA-256 completely:
SHA-256("pay Bob 25") = 3ba8f1d9 6fdc5360 b5100e6f 9013172b
9ce99fec a2ba12c7 25a0e56e 18c906fb
SHA-256("pay Bob 26") = 969fb2bf d9c3d2aa 54483393 9b646a97
8b7669b7 f095ef92 ee4f5857 2c695ee3
SHA-256 is the hash function running in the figures of this part. It compresses a message of any length into a 32-byte digest, and the two digests above differ in 143 of their 256 bits, roughly half, just as two independent random strings would. Evaluating SHA-256 forward takes one function call; working backward from a digest to any input that produces it is assumed to admit no method much faster than exhaustive trial, the one-way property formalized next.
Definition 8.1.1 (preimage resistance). A hash function \(H\) with outputs of \(n\) bits is preimage resistant if, given \(y = H(x)\) for a random input \(x\), no feasible computation finds an \(x^{\prime}\) with \(H(x^{\prime}) = y\). Trying inputs one after another takes about \(2^{n}\) evaluations of \(H\).
It is an assumption: nobody has proved that any function is hard to invert. FIPS 205 says as much on its first pages.
This standard defines a method for digital signature generation that can be used for the protection of binary data (commonly called a message) and for the verification and validation of those digital signatures.1 The security of the stateless hash-based digital signature algorithm (SLH-DSA) relies on the presumed difficulty of finding preimages for hash functions as well as several related properties of the same hash functions. Unlike the algorithms specified in FIPS 186-5 [1], SLH-DSA is designed to provide resistance against attacks from a large-scale quantum computer.
โNIST, FIPS 205, "Stateless Hash-Based Digital Signature Standard" (2024). Section 1.1, its first paragraph; the 1 after its first sentence is the mark of a footnote, which points to NIST SP 800-175B for a general discussion of digital signatures. FIPS stands for Federal Information Processing Standard; FIPS 186-5 is the one for the signatures in use today, the elliptic-curve signature ECDSA among them. FIPS 205 was published on 13 August 2024: doi:10.6028/NIST.FIPS.205.
A quantum computer changes the count by a square root and, as far as is known, no more: Grover's search (Section 2.6) finds a preimage in about \(2^{n/2}\) evaluations, and nothing like the hidden period of Section 2 is known in a hash function. The answer to a square root is size. NIST grades strength in security categories defined by searches of this kind: categories 1, 3 and 5 mean at least as hard to break as finding a key of the block cipher AES with 128, 192 and 256 bits, and FIPS 205 claims them for SLH-DSA with hash values of 16, 24 and 32 bytes.
Both signature schemes of Section 7 already rely on a hash function alongside a lattice assumption: ML-DSA derives its challenge by hashing the commitment with the message, and Falcon signs a salted hash of the message. Building a signature from the hash function alone drops the lattice assumption altogether, making it the most conservative post-quantum design. Its price, as throughout this series, is paid in bandwidth and operational care.
One signature opens half the key
The one-time signature that Lamport proposed in 1979 uses a hash function and nothing else.L. Lamport, "Constructing digital signatures from a one way function", SRI International report CSL-98, 18 October 1979. The report's own layout differs: 40 values are published, and a signature reveals the 20 secrets that a function of the document selects. A pair of secrets for each bit is how the idea has been told since. Merkle's paper of the same year signs the bits of the message followed by their complements, one secret a bit, which comes to the same thing, and credits it to Lamport and Diffie. For every bit of the message's digest, keep a pair of secrets and publish the hashes of both. To sign, reveal one secret of each pair: the first if the bit is 0, the second if it is 1. Anyone can hash the revealed secrets and compare the results with the public key.
key pair 1 2 3 ... 256 256 pairs of secrets, and their 512 SHA-256 hashes: the public key
secret, 0 [ ] [ ] [##] ##: revealed by a signature
digest bit 1 1 0 a signature reveals one secret of each pair, the one that a bit
secret, 1 [##] [##] [##] of the message's digest points at: 256 secrets, 8,192 bytes
rows signatures made secrets share of all messages that anyone can then sign
with one key out this key on average over the messages signed
1 256 of 512 2^-256 2^-256
2 385 2^-127 2^-106
5 498 2^-14 2^-12
9 511 2^-1 0.61
search [forge] tries "pay Eve 1000 #0", "#1", ... with SHA-256. After 2 signatures it finds a message that
the first 32 pairs can sign in 19,803 tries (65,536 expected); for all 256 pairs 2^127 are expected.
After 5 signatures it finds one for the whole key in 10,411 tries (16,384 expected); it verifies.
(the live figure needs JavaScript; it loads no data)
A signature is half of the private key, made public. That is why it convinces: only the owner could have produced 256 values that hash to published ones, and which 256 is fixed by the message. It is also why the key is spent, for what has been revealed stays revealed.
Definition 8.2.1 (the one-time signature). Let \(H\) be a hash function with outputs of 256 bits. The private key is 512 random values \(x_{i,b}\), for \(i = 1, \dots, 256\) and \(b \in \{0, 1\}\), and the public key is their hashes \(y_{i,b} = H(x_{i,b})\). If the digest \(H(m)\) of a message \(m\) has the bits \(d_1, \dots, d_{256}\), the signature of \(m\) is
\[\sigma = \bigl(x_{1,d_1},\; x_{2,d_2},\; \dots,\; x_{256,d_{256}}\bigr),\]and the verifier accepts \(\sigma\) if \(H(\sigma_i) = y_{i,d_i}\) for every \(i\).
Two properties are required of \(H\). First, \(H\) must resist preimage search: a forger who has seen no signature would have to invert \(H\) at all 256 positions, and one who has seen a single signature still has to invert \(H\) at every bit position where the target digest differs from the signed one. Second, \(H\) must resist collisions, pairs of distinct messages with the same digest, since a valid signature on one immediately verifies on the other; because roughly \(2^{n/2}\) messages suffice for a collision to appear by the birthday paradox, a scheme aiming for 128 bits of classical security uses 256-bit digests. In the page's JavaScript implementation (L = 256), all 512 secret values are derived pseudorandomly from a single 32-byte seed, keeping the stored private key tiny in the same way SLH-DSA will in Section 8.5:
for (var b = 0; b < 2; b++) for (var i = 0; i < L; i++) {
sk[b][i] = sha256(BYTES.concat(seed, Uint8Array.of(b), u16(i))); // a secret for bit value b at position i
pk[b][i] = sha256(sk[b][i]); // and its hash, published
}
// ...
var d = digestBits(message, key.L), sig = d.bits.map(function (b, i) { return key.sk[b][i]; }); // open one of each pair
// ...
match[i] = BYTES.equal(sha256(sig[i]), pk[d.bits[i]][i]); // the revealed secret hashes to the published value
With values of 32 bytes, the public key of this pair scheme is 16,384 bytes and a signature 8,192, for one message.
What a second signature gives away can be counted. Two digests agree in about half of their 256 positions; where they differ, both secrets of the pair are now public. Anyone can then sign a message whose digest uses public secrets only, which means that its bits equal the signed ones wherever the two agreed. In the key that signed pay Bob 10 and pay Carol 25, 385 of the 512 secrets are out, both of them in 129 pairs, so one digest in \(2^{127}\) can be signed by anyone, and a forger who tries messages until one fits should expect \(2^{127}\) tries. That is not a forgery. But every further signature opens about half of what is still closed. After five signatures the same key has 498 secrets out and covers one digest in \(2^{14} = 16{,}384\); a search through the messages pay Eve 1000 #0, #1, #2 and so on found a covered one at the 10,411th try, and its signature, put together from revealed secrets, verifies.
On average over the messages signed there is a closed form. After \(k\) signatures, the secret that a forger needs at one position is still closed only if all \(k\) digests had the other bit there, so a random digest is covered with probability \((1 - 2^{-k})^{256}\): \(2^{-106}\) at two signatures, \(2^{-49}\) at three, \(2^{-12}\) at five, 0.37 at eight and 0.61 at nine.
Remark 8.2.2 (the average is not the typical key). After two signatures the average formula gives \(2^{-106}\), whereas the specific key that signed twice above stood at \(2^{-127}\). Both figures are right. For any pair of signed messages, the covered fraction is \(2^{-A}\), where \(A\) counts the bit positions on which the two digests agree, a binomial variable of mean 128. Typically \(A\) sits near 128, leaving \(2^{-A}\) near \(2^{-128}\); because \(2^{-A}\) grows steeply when \(A\) is small, however, the expectation \((3/4)^{256} = 2^{-106}\) is pulled upward by the rare pairs of digests that happen to disagree on far more than half their bits. Either way, two signatures leave forgery out of reach at 256 bits, while nine signatures expose more than half of all digests on average. Calling the scheme one-time means that its clean security proof covers a single signature, after which security degrades according to these combinatorial counts.
Four bits a chain, and a checksum
Lamport's pair scheme spends two 32-byte public hashes and one 32-byte signature element on every single bit of the digest. Winternitz chains cut the signature by nearly a factor of four by encoding four bits at once, a hexadecimal digit \(d \in \{0, \dots, 15\}\), as the position along a single chain of repeated hashes. Starting from one secret seed, hash it 15 times in succession to form a 16-node chain whose final node is published; to sign the digit \(d\), reveal the intermediate node \(d\) steps from the secret, and let the verifier hash it the remaining \(15 - d\) steps to confirm that it lands on the published end.
chains SHA-256("pay Bob 25") = 3ba8f1d9...: a hex digit (4 bits) of the digest to a chain of 16 nodes
chain digit secret -> SHA-256 -> ... -> SHA-256 -> public value
1 3 / / / [#] . . . . . . . . . . . P #: the node the signature reveals,
2 b = 11 / / / / / / / / / / / [#] . . . P as many hashes from the secret as the digit
... /: nodes only the signer has .: anyone can hash on
64 chains for the digest and 3 for the checksum, 477 (the sum of 15 - digit): 67 nodes, 2,144 bytes
forger wants the digit of chain 1 to be 6, not 3: 3 hash calls forward, and the 64 message chains still verify.
But the checksum would be 474: its chain 3 would have to go from node 13 back to node 10.
Without a checksum anyone could sign 2^174 of the 2^256 digests.
chart nodes in a chain 2 4 16 256
chains 265 133 67 34
signature bytes 8,480 4,256 2,144 1,088
hash calls, signing and verifying together 265 399 1,005 8,670
(the live figure needs JavaScript; it loads no data)
Along a chain, forward is hashing, which anyone can do, and backward is inverting the hash. So a revealed value signs its digit and, left at that, every larger digit as well: whoever holds the value three steps along can compute the value six steps along. In the signature of pay Bob 25, to raise the first digit from 3 to 6 costs a forger three hash calls, and by such steps anyone could sign about \(2^{174}\) of the \(2^{256}\) digests, every one whose digits are all at least the signed ones.
The remedy is a checksum. Add up, over all chains, how many steps each revealed value still is from the public end, write that sum in hexadecimal, and sign its digits on three more chains. A forward step in any chain makes the sum smaller, and a smaller number has a smaller digit somewhere: a step backward on a checksum chain. For the forger's move the sum falls from 477 to 474, and the last checksum chain would have to be walked three steps back.
Definition 8.3.1 (chains with a checksum). Fix a chain length \(w\), here 16, and write \(H^{j}\) for \(H\) applied \(j\) times. Let \(d_1, \dots, d_{\ell_1}\) be the digits of the message's digest in base \(w\) (64 hexadecimal digits for 256 bits), let
\[C = \sum_{i=1}^{\ell_1} (w - 1 - d_i)\]be the checksum, and let \(d_{\ell_1 + 1}, \dots, d_{\ell}\) be its digits in base \(w\) (three of them, since \(C \le 64 \cdot 15 = 960 < 16^3\), so \(\ell = 67\)). The private key is \(\ell\) random values \(x_i\), the public key is the chain ends \(y_i = H^{w-1}(x_i)\), the signature is \(\sigma_i = H^{d_i}(x_i)\) for \(i = 1, \dots, \ell\), and the verifier accepts if \(H^{w - 1 - d_i}(\sigma_i) = y_i\) for every \(i\).
Appending those three checksum chains closes the forward-hashing loophole completely: raising any message digit shrinks \(C\), forcing at least one checksum digit to decrease.
Proposition 8.3.2 (forward steps are not enough). Let \(d\) and \(d^{\prime}\) be the digit strings, checksum digits included, of two different digests. Then \(d^{\prime}_i < d_i\) for some \(i\): no signature of the first can be turned into a signature of the second without a step backward on some chain.
Proof. If a message digit of \(d^{\prime}\) is smaller than the same digit of \(d\), that is the \(i\). Otherwise every message digit is at least as large and one is larger, so \(C^{\prime} < C\). Two numbers written with the same number of digits compare as words do in a dictionary: at the first digit where \(C^{\prime}\) and \(C\) differ, that of \(C^{\prime}\) is the smaller. โ
Stepping backward on a chain requires finding a hash preimage of a revealed node, the exact problem Definition 8.1.1 assumes infeasible. In the page's implementation, iterate applies SHA-256 repeatedly: signing advances each chain by its digit v, checksum accumulates the remaining steps w - 1 - v across the 64 message chains, and verification walks the rest of each chain to check its endpoint:
function iterate(x, steps) { for (var s = 0; s < steps; s++) x = sha256(x); return x; }
// ...
checksum += p.w - 1 - v; // how far each chain is from its end
// ...
var sig = d.all.map(function (v, i) { return iterate(key.sk[i], v); }); // node v of chain i
// ...
ends[i] = iterate(sig[i], p.w - 1 - d.all[i]); // walk the rest of the chain
ok = BYTES.equal(ends[i], pub.pk[i]);
The chain is as old as the tree of Section 8.4 and comes from the same paper, written by Merkle in 1979. It first halves the pair scheme, with one secret a bit and the count of the message's zero bits signed along with it, and then reports a suggestion by Robert Winternitz to hash a secret many times over so that it signs four bits.R. Merkle, "A certified digital signature", written in 1979 for the Communications of the ACM and printed in the proceedings of CRYPTO 1989, p. 218 (doi:10.1007/0-387-34805-0_21), Sections 4 and 5. Its example signs the four bits 1001, nine in decimal, with the secret hashed nine times, and notes that anyone can hash once more and claim 1010. The word checksum is not in it: the remedy is "a slight extension of the method described in section 4", which is the count of zeros. For chains of two values the sum of Definition 8.3.1 is that count. The paper sums the suggestion up: "Winternitz's method trades time for space: the reduced size is purchased with an increased computational effort." NIST's recommendation for the two chain-based schemes of Section 8.4 states what the checksum is for.
In order to protect against the above attack, the Winternitz signature scheme computes a checksum of the message digest and signs the checksum along with the digest. For an n-digit message digest, the checksum is computed as โ๐=0๐โ1(๐ โ 1 โ ๐๐). The checksum is designed so that the value is non-negative, and any increase in a digit in the message digest will result in the checksum becoming smaller. This prevents an attacker from creating an effective forgery from a message signature since the attacker can only increase values within the message digest and cannot decrease values within the checksum.
โNIST, SP 800-208, "Recommendation for Stateful Hash-Based Signature Schemes" (2020). D. Cooper and others, NIST Special Publication 800-208, October 2020 (doi:10.6028/NIST.SP.800-208), Section 3.1, the paragraph on the checksum. Its sum is the sum of Definition 8.3.1, with ๐ for the chain length, ๐ for the number of digits of the digest and ๐๐ for a digit; the page sets the two limits of the sum one above the other. The attack it calls the above one is the forward step on a chain.
Longer chains mean fewer of them and more hashing. For a 256-bit digest, chains of 16 values make 67 chains, a signature of 67 values of 32 bytes, which is 2,144 bytes in place of the 8,192 of the pair scheme, and 1,005 hash calls for signing and verifying together, since between them the two walk every chain once from end to end. Chains of 256 values halve the bytes to 1,088 and cost 8,670 calls. FIPS 205 uses 16. Chains have a second advantage over pairs: the verifier arrives at the public values by its own computation, so nobody has to send them, and one hash of all the chain ends is public key enough.
One root for many keys, and a counter
Winternitz chains shrink a one-time signature to 2,144 bytes and compress its public key into one digest, yet the key is still spent after signing a single message. To authenticate thousands or millions of one-time keys under a single fixed 32-byte public key, Ralph Merkle arranged them as the leaves of a binary Merkle tree: hash each one-time public key into a leaf, hash adjacent leaves in pairs, and repeat up the levels until a single 32-byte root vouches for the entire collection.
tree the root, 32 bytes, is the whole public key db6c
a node is the SHA-256 of its two children / \
bec5 [3b85]
/ \
8d49 [d5b5]
/ \
[d026] a113
/ \
a leaf is the SHA-256 of a one-time public key 279c [2da2]
one-time keys 1 2 3 4 5 ... 16 [ ]: the authentication path of signature 5, the sibling
have signed x x xx x at each height: 4 nodes, 128 bytes
state the signer's counter: next leaf 4 yesterday's backup: next leaf 3
leaves 1 and 2 signed yesterday, 3 and 4 today; the backup was restored, and signature 5 used leaf 3 again
leaf 3 signature 3, "pay Dan 7" reveals 256 of the 512 secrets of its one-time key
signature 5, "pay Frank 3" reveals 256
both together 388: both secrets of 132 pairs, so that anyone can sign 1 message in 2^124
size a signature: 8,192 bytes of one-time signature, 16,384 of its public key, 128 of path; 262 hash calls to verify
at real size: SLH-DSA-SHA2-128s stacks 7 layers of trees of 512 leaves, with 9 siblings a path
(the live figure needs JavaScript; it loads no data)
A signature now names its leaf and has three parts: a one-time signature, the one-time public key it verifies under, and the authentication path, which is the sibling of each node on the way from that key's leaf to the root. The verifier checks the one-time signature, hashes the one-time public key into its leaf and combines it with the siblings, level by level; if the result is the root, the one-time key belongs to the tree. The verifier never sees the tree. For sixteen keys the path is four siblings, 128 bytes, under a public key of 32 bytes; for \(2^{20}\) keys, about a million, it would be 20 siblings and 640 bytes.
Number the nodes of each level from the left, starting at 0, and write \(v_{z,j}\) for node \(j\) at height \(z\). Then
\[v_{z,j} = H\bigl(v_{z-1,\,2j} \,\Vert\, v_{z-1,\,2j+1}\bigr),\]where \(\Vert\) joins two byte strings, the sibling of node \(j\) is node \(j \oplus 1\), and bit \(z\) of the leaf index determines whether the current node sits to the left or the right of its sibling at height \(z\). In the page's code, the verifier climbs from the hashed leaf node to the root in one short loop:
for (var z = 0; z < path.length; z++) {
node = ((index >>> z) & 1) === 0 ? hash(node, path[z]) : hash(path[z], node); // left child or right child
// ...
}
var ok = BYTES.equal(node, rootValue);
The leaves of the tree of sixteen keys hold pair keys, so that a leaf used twice shows the picture of Section 8.2, and each of its signatures carries 16,384 bytes of one-time public key. Real schemes put chain keys under the leaves and that part disappears: the verifier walks every chain to its end and hashes the ends into the leaf.
The tree brings an obligation of a new kind. A leaf may sign once, so the signer has to know which leaves are used: the private key holds a counter, and it changes with every signature. Such a scheme is called stateful. A private key that changes is a hazard that no earlier scheme of this series had. The paper that later made a practical scheme without the counter puts it in one sentence: "If the update fails (for example, if a key is copied from one device to another, or backed up and later restored) then security disintegrates."D. J. Bernstein and others, "SPHINCS: practical stateless hash-based signatures", EUROCRYPT 2015, Section 1. In the tree of sixteen keys yesterday's backup of the counter was restored: the counter pointed at leaf 3 again, both signatures of that leaf verify, and together they give away 388 of the 512 secrets of a key that was safe to use once.
Two schemes of this kind have public specifications: XMSS, the eXtended Merkle Signature Scheme, and LMS, the Leighton-Micali signatures. Both documents carry the same warning.
In contrast to traditional signature schemes, the signature schemes described in this document are stateful, meaning the secret key changes over time. If a secret key state is used twice, no cryptographic security guarantees remain. In consequence, it becomes feasible to forge a signature on a new message. This is a new property that most developers will not be familiar with and requires careful handling of secret keys. Developers should not use the schemes described here except in systems that prevent the reuse of secret key states.
โD. McGrew, M. Curcio and S. Fluhrer, RFC 8554, "Leighton-Micali Hash-Based Signatures" (2019). Section 1.1 (doi:10.17487/RFC8554). An RFC, a Request for Comments, is a document of the internet's series of technical specifications. The same paragraph stands in the same place in RFC 8391, A. Huelsing and others, "XMSS: eXtended Merkle Signature Scheme" (2018).
NIST approved both in 2020, for a narrow use. Its recommendation calls stateful schemes "not suitable for general use", names the authentication of firmware updates as an application that may fit, and requires that keys be generated and used inside hardware modules that never export them, not even encrypted.NIST SP 800-208, Section 1 and Section 1.1. In the passages quoted from it, HBS abbreviates hash-based signature and OTS one-time signature. The reason for the last rule is the backup.
If a digital signature key will be used to generate signatures over a long period of time and replacing the public key would be difficult, then it will be necessary to prepare for the possibility that a cryptographic module holding the private key may fail during the keyโs lifetime. In the case of most digital signature schemes, a common solution is to make copies of the private key. However, in the case of stateful HBS schemes, simply copying the private key would create a risk of OTS key reuse.
โNIST, SP 800-208 (2020). The opening paragraph of Section 7, which goes on to forbid the export of private keys.
Even a single copy has to be kept with care. The same document notes that "simply writing the update to a file is not sufficient because the write operation will be cached": after a crash that loses the new value of the counter, the next signature uses a leaf whose signature has already left the module.NIST SP 800-208, Section 9.1.
Remark 8.4.1 (a reused leaf, in pairs and in chains). The RFC warning is absolute, whereas the reused leaf in the 16-leaf figure above still left a forger facing one message in \(2^{124}\). Two facts justify the starker warning. First, the security proof covers at most one signature per leaf, and nothing bounds how many times a rolled-back virtual machine or faulty counter might reuse the same state. Second, XMSS and LMS place Winternitz chains rather than Lamport pairs at their leaves, and chains degrade far faster on reuse: given two nodes revealed on the same chain, whichever sits closer to the secret seed yields the further node and every step beyond it by forward hashing, so a third digest can be forged whenever every one of its 67 digits (checksum included) is at least the minimum of the two digits already signed on that chain. Those vulnerable digests can be counted exactly without searching. For the same two messages signed under a 67-chain key as in Definition 8.3.1, one digest in \(2^{68}\) is forgeable. Across 2,000 pairs of short messages (invoice 0 with invoice 1, invoice 2 with invoice 3, and so on), the median forgeable share was one digest in \(2^{61}\), and on 192 of the 2,000 pairs, roughly one in ten, it exceeded one in \(2^{36}\), well within reach of a practical search. Every one of those 192 pairs belonged to the 601 pairs whose two checksums differed in their most significant digit, where the top checksum chain requires only the smaller of the two digits and leaves the checksum guarding very little; across the remaining 1,399 pairs the worst case was about one digest in \(2^{44}\). These counts apply to the plain chains of Section 8.3, which share the layout of 32-byte XMSS chains; neither XMSS nor LMS was run, and no forgery was made at this size.
What the counter buys is size. A signature of XMSS with \(2^{20}\) leaves and 32-byte hashes is 2,820 bytes, most of them the 67 chain values and the 20 siblings.The parameter set XMSS-SHA2_20_256 of RFC 8391, whose parameter guide tabulates the size. Its public key is 68 bytes: a root and a seed of 32 each, and four that name the parameter set. For firmware signed a few thousand times inside one guarded device, that is a fair trade. For a function named sign that any program may call on any machine, restored from any backup, it is not, and the standard for general use had to do without the counter.
No counter: a leaf picked by a hash
The counter is there so that no leaf signs twice. It can be dropped if two things are arranged: a tree with so many leaves that a hash can pick one afresh for every message, and under each leaf a key that survives the few repeats that such picking produces.
tower the tree of trees, root on top: in each layer the one tree this signature passes through and the leaf
it uses, of 512; beside each layer its bytes, to scale. Read upward:
public key 32 bytes: a seed, and the root that verifying must reach (not in the signature)
layer 7 leaf 163 one-time signature 560 bytes + authentication path 144 bytes
layer 6 leaf 184 560 + 144
layer 5 leaf 185 560 + 144
layer 4 leaf 425 560 + 144
layer 3 leaf 117 560 + 144
layer 2 leaf 100 560 + 144
layer 1 leaf 162 560 + 144; this leaf signs the FORS public key
FORS 14 trees of 4,096 leaves, a leaf picked in each: 14 ร (16 + 192) = 2,912 bytes
R randomizer, 16 bytes; the hash of R, the public key and the message picks every leaf
total 7,856 bytes, 491 hashes of 16: one-time signatures 3,920 (50%), their authentication paths 1,008 (13%),
the few-time signature 2,912 (37%); signing made 2,185,957 hash calls, verifying 2,204
other the fast set, SLH-DSA-SHA2-128f: 22 layers of 8-leaf trees, 608 bytes a layer, 17,088 bytes; the small set
signs with 20.8 times its hash calls
(the live figure needs JavaScript; it signs in the page and loads about 0.02 MB of data)
The signer never counts: the hash of a randomizer (a value that the signer derives for each signature and sends with it), the public key and the message names one leaf among \(2^{63}\), and the signature is the proof that this leaf hangs under the root in the public key. Three devices make that affordable.
First, the keys under the leaves are few-time keys, called FORS, for forest of random subsets. FORS is the pair scheme of Section 8.2 with 4,096 choices at each position where that scheme had two. In the smallest parameter set a key is 14 groups of 4,096 secrets; the part of the digest it signs, 168 bits, is cut into 14 numbers of 12 bits, and each names the one secret of its group to reveal. A signature thus opens one secret in 4,096 of every group, where the pair scheme opened one in two, and a forger who has seen \(\gamma\) signatures from one key finds a random digest covered with probability at most \((\gamma/4096)^{14}\): \(2^{-168}\) after one signature, \(2^{-154}\) after two, \(2^{-126}\) after eight, where eight signatures left the pair scheme covering 0.37 of all digests on average. A tree of hashes over each group reduces its 4,096 public hashes to one root, so every revealed secret travels with 12 siblings, and the 14 roots hashed together are the public value of the key.
Second, the \(2^{63}\) leaves are not the leaves of one tree, which nobody could build, and a signer has to build a tree to give a path in it. They are reached through seven layers of trees of 512 leaves, a tree of trees that the standard calls a hypertree.A tree without a counter, with its leaf picked by a hash of the message or at random, is Goldreich's idea; carried out directly it gave signatures of more than a megabyte. The few-time key at the bottom and the tree of trees are the two ideas of the SPHINCS paper of 2015, whose signatures were 41 kilobytes. FIPS 205 standardizes its successor: D. J. Bernstein and others, "The SPHINCS+ signature framework", ACM CCS 2019 (eprint 2019/1086). Each leaf is a chain key as in Section 8.3 (the standard's variant is called WOTS+, for Winternitz one-time signature plus) and signs the root of one tree in the layer under it; the leaves of the lowest layer, \(512^7 = 2^{63}\) of them, each sign the public value of one few-time key. A signature passes through one tree a layer, so the signer builds seven trees of 512 leaves, and the verifier none.
Third, nothing of this giant structure is ever stored on disk. Every secret node across all \(2^{63}\) leaves is derived on the fly by hashing one 16-byte master seed together with the node's tree and leaf coordinates, shrinking the entire private key to 64 bytes and letting the signer rebuild just the seven small trees along the active path. Deterministic derivation also explains why WOTS+ chain keys remain safe in the upper layers even when two signatures pass through the same tree and leaf: every time a chain key is invoked, it signs the exact same child-tree root or FORS public key fixed beneath it by the master seed. Only the bottom-level FORS keys ever sign distinct message digests, and FORS is built to absorb occasional repeats.
In the page's JavaScript implementation, signing follows Algorithm 19 of FIPS 205 (step numbers in comments): derive a per-message randomizer R, hash it with the public key and message to split the digest into the FORS message bits and the 63-bit leaf address, sign the message bits with FORS, and climb the seven-layer hypertree with htSign:
var R = C.PRFmsg(SKprf, optRand, M); // 3: the randomizer (4: SIG <- R)
var digest = C.Hmsg(R, PKroot, M); // 5
var dg = splitDigest(P, digest); // 6-10
// ...
var SIGFORS = forsSign(C, dg.md, SKseed, ADRS); // 14 (15: SIG <- SIG || SIG_FORS)
// ...
var PKFORS = forsPkFromSig(C, SIGFORS, dg.md, ADRS, roots); // 16
var SIGHT = htSign(C, PKFORS, SKseed, dg.idxtree, dg.idxleaf, path); // 17
var SIG = BYTES.concat(R, SIGFORS, SIGHT); // 18
PRFmsg derives the randomizer from a second secret and the message. Hmsg hashes it with the public key and the message into a digest of 30 bytes, which splitDigest cuts into the 168 bits that the few-time key signs and the 63 bits that name the leaf: 54 for the tree in the lowest layer, nine for the leaf in it. htSign makes the seven one-time signatures and their paths. The verifier computes the same digest from the randomizer in the signature, so the number of the leaf is not sent, and a forger cannot choose the leaf apart from the digest.
FIPS 205 describes the key in the first sentence of a paragraph of its overview, and the signature in the rest of it.
Conceptually, an SLH-DSA key pair consists of a very large set of FORS key pairs.3 The few-time signature scheme FORS allows each key pair to safely sign a small number of messages. An SLH-DSA signature is created by computing a randomized hash of the message, using part of the resulting message digest to pseudorandomly select a FORS key, and signing the remaining part of the message digest with that key. An SLH-DSA signature consists of the FORS signature and the information that authenticates the FORS public key. The authentication information is created using XMSS signatures.
โNIST, FIPS 205 (2024). Section 3, the overview, its second paragraph. The 3 after its first sentence is the mark of a footnote of the standard, which gives the size of the set for its parameter sets: 263, 264, 266 or 268 FORS keys, generated pseudorandomly from a single seed.
Example 8.5.1 (the 7,856 bytes of a signature). When SLH-DSA-SHA2-128s, one of the two smallest parameter sets in FIPS 205, signs pay Bob 25 in the page, every field of the resulting signature is an \(n = 16\)-byte hash value. Its FORS key has \(k = 14\) groups of \(2^{a}\) secrets with \(a = 12\); its hypertree stacks \(d = 7\) layers of trees of height \(h^{\prime} = 9\); and each WOTS+ chain key holds \(\ell = 35\) chains, 32 for the hexadecimal digits of a 16-byte root plus three for their checksum. Adding up the randomizer, one revealed secret plus \(a\) authentication siblings per FORS group, and one WOTS+ signature plus \(h^{\prime}\) siblings per hypertree layer gives
which is 491 hash values. By kind, the seven one-time signatures are 3,920 bytes, 50% of the signature; their seven authentication paths are 1,008, or 13%; the few-time signature is 2,912, or 37%; and the randomizer is the remaining 16 bytes. The same sum with the parameters of the other sets gives every size up to the largest, 49,856 bytes. The public key is 32 bytes, a seed and the root. โ
A leaf picked by a hash can be picked twice, and with enough signatures it will be. The parameter sets are built for \(2^{64}\) signatures a key, which FIPS 205 illustrates as ten billion signatures a second for more than 58 years. At that number the \(2^{63}\) few-time keys of the smallest set have signed twice each on average, and the slow decay of a few-time key is what makes that tolerable. The limit belongs to the design, as NIST's report on its choice of the scheme says.
The design of SPHINCS+ imposes a limit on the number of allowable signatures from a given public key. For any number of signatures using the public key, g, there is some very low probability that they will reveal enough of the private key to allow an attacker to forge a signature. As g grows, so does the probability of this disaster. The total number of signatures must be kept low enough that this probability remains negligible. NISTโs call for proposals [9] required the ability to securely perform 264 signatures, which imposes requirements on the parameters of SPHINCS+. A smaller maximum number of signatures would result in somewhat smaller and faster signatures. NIST intends to ask for public feedback on whether such a version of SPHINCS+ would be beneficial.
โNIST, IR 8413, "Status Report on the Third Round of the NIST Post-Quantum Cryptography Standardization Process" (2022). G. Alagic and others, NIST IR 8413, update 1, Section 4.4.3, the paragraph on the limit. SPHINCS+ is the scheme that FIPS 205 standardizes as SLH-DSA, and [9] is the report's reference to NIST's call for proposals of 2016.
Stateless does not mean without limit. It means that nobody has to remember anything.
The bill, and when to pay it
Each step of this part removed a limit and added a cost. With hash values of 32 bytes throughout, the steps and their bills are these.
From a one-time signature to a stateless oneeach step removes the limit of the step before it and adds a cost; the bytes are those of one signature with hash values of 32 bytes
FROM ONE-TIME TO STATELESS
8.2pairs of secrets 8,192 bytes, one message ยท Publish the hashes of 256 pairs of secrets. A signature reveals one secret of each pair, the one a bit of the message's digest picks: half of the key. Every further signature opens more, so a key signs once.
8.3chains and a checksum 2,144 bytes, one message ยท A secret hashed 15 times signs four bits: the signature is the value as many steps along as the digit says. Three more chains sign a checksum, so that a forger who walks one chain forward must walk another back.
8.4a tree and a counter 2,820 bytes, 2^20 messages ยท Hash the one-time public keys in pairs up to one root, the public key. A signature adds the 20 siblings on its leaf's way to the root. No leaf may sign twice, so the private key holds a counter that must never go back.
8.5a tree of trees, no counter 29,792 bytes, 2^64 messages ยท Make the tree so large that a hash of the message picks the leaf, put a few-time key under every leaf, and stack small trees so that only the ones on the path are ever built, all of it from one seed. This is SLH-DSA.
green: the construction that FIPS 205 standardizes as SLH-DSA
At equal hash size the counter was worth a factor of ten: 2,820 bytes for a stateful signature that serves \(2^{20}\) messages, 29,792 for SLH-DSA-SHA2-256s, which serves \(2^{64}\). The stateless construction comes in twelve parameter sets: hash values of 16, 24 or 32 bytes for the categories 1, 3 and 5; SHA-2, the family of SHA-256, or SHAKE, a function of the SHA-3 family, as the hash; and a variant s for small or f for fast.
chart the bytes of a signature (across, to scale from zero) against hash calls (up, logarithmic); every
set stands twice, to sign and to verify; one signature a set
bytes to sign to verify small against fast: bytes, to sign, to verify
128s 7,856 2,185,942 2,099 46%, 20.8 times, 0.33 times
128f 17,088 104,967 6,306
192s 16,224 3,766,905 3,087 45%, 22.3 times, 0.35 times
192f 35,664 168,866 8,922
256s 29,792 3,280,410 4,394 60%, 9.5 times, 0.49 times
256f 49,856 345,354 8,987
(the SHA2 sets; their SHAKE twins build the same trees and make the same calls to within a few percent)
flags on the axis of bytes only, for scale: Ed25519 64 bytes, ML-DSA-65 3,309 bytes
(the live figure needs JavaScript and loads about 0.2 MB of data)
Every category has a small and a fast variant: the small one makes the signature about half as long and pays for it with 21, 22 and 9.5 times the hashing at each signature, at categories 1, 3 and 5. Verification goes the other way: the small sets, with fewer and taller trees, verify with a third to a half of the hash calls of the fast ones.A hash call is one call of any of the six functions that FIPS 205 builds from its hash function: F for a step along a chain, H for a node of a tree, T to compress many values into one, PRF and PRF_msg to derive secrets and the randomizer, and H_msg for the digest of the message.
The dial is the number of layers \(d\). A signature carries \(d\) one-time signatures, so fewer layers make it shorter. But fewer layers mean taller trees, and the signer builds every tree that its signature passes through: \(d \cdot 2^{h^{\prime}}\) one-time keys at each signature. That is \(7 \cdot 512 = 3{,}584\) keys in the small set of category 1 and \(22 \cdot 8 = 176\) in the fast one. A chain key is 35 chains of 15 steps, so the chains of the small set's keys alone cost about 1.88 million hash calls, \(3{,}584 \cdot 35 \cdot 15 = 1{,}881{,}600\), of the 2,185,957 that signing pay Bob 25 took; verifying it took 2,204 (both counts shift a little from one message to the next). The verifier walks only the \(d\) one-time signatures it is handed, which is why the set with fewer layers is also the cheaper one to verify.
Compared with ML-DSA-65 (Dilithium) at matching security category 3, SLH-DSA produces signatures of 16,224 bytes (small) or 35,664 bytes (fast) versus 3,309 bytes for ML-DSA-65, while shrinking the public key to 48 bytes versus 1,952. On one core of a 16-core server using OpenSSL, in one run each, the two SHA-2 sets at category 3 produced 1.62 and 37.9 signatures per second compared with 1,415 for ML-DSA-65, and verified 1,883 and 718 per second compared with 7,398. Section 7.6 places all of these schemes side by side.
When is that worth paying? NIST's reason for the standard is insurance. Its report calls the security of the scheme "well-understood", says that it was standardized "to not rely entirely on the security of lattices", and grants that it "may not be suitable for many applications, given its performance profile".NIST IR 8413, Section 2.3. What is known against lattices of the kind the standards use is the subject of Section 5.6 and of Section 10.
Slow signing matters little where signatures are made rarely and verified often, as on software, firmware and certificates. For those uses a draft of April 2026 proposes six further parameter sets that give up most of the \(2^{64}\): at most \(2^{24}\) signatures a key, for a signature of 3,856 bytes at category 1 in place of 7,856. The draft calls them "not approved for general-purpose use", because the user must now see to it that the limit is never passed, which brings back a count, if a forgiving one.Q. Dang and D. Moody, "Additional SLH-DSA Parameter Sets for Limited-Signature Use Cases", NIST SP 800-230, initial public draft, April 2026 (doi:10.6028/NIST.SP.800-230.ipd); comments were due by 12 June 2026. Where one guarded device does all the signing, the counter of Section 8.4 can be kept, and with it the shorter signature. And where a connection carries several signatures at once, as the handshakes of Section 11.3 do, the size is multiplied and counts against it.
A signature from a hash function reveals part of a secret whose hash was published beforehand, so a key can sign only so much, and in the simplest form it signs once. Chains, trees and a seed stretch such keys into one that signs without keeping count, and the price is paid in bytes and in hashing, not in a second assumption.