Winternitz parameter selection for signature size and for the blast radius of state failure.
Hash-based signatures are one-time by construction: a W-OTS key signs once, and a state failure that reuses it leaks chain material. The Winternitz parameter w is chosen for signature size and speed. This asks what it does to the damage when state management fails, and the two criteria point opposite ways.

Every treatment of stateful hash-based signatures says never reuse a one-time key. None says how bad one slip is. State failure is the real deployment risk: a restored backup, a cloned image, a counter reset after power loss. An operator who finds one duplicated index has to decide whether to rotate keys or scrap the device, and there is no number to decide with.
The attacker modelled here does no cryptanalysis at all. They hash forward from values the signer has already published, which is a public operation.
The blast-radius curve. Forgeable fraction against the number of times a key is reused:
| reuses | forgeable fraction |
|---|---|
| 1–4 | below Monte-Carlo resolution |
| 5 | 1 in 12,000 |
| 6 | 1 in 2,400 |
| 7 | 1 in 750 |
| 8 | 1 in 185 |
Exposure is non-monotonic in w, and the extremes are the worst choices. At four reuses, forgeability is 1.902e−06 at w = 2 and 5.942e−04 at w = 8, making w = 8 about 312× more exposed. That is the opposite of the size-driven recommendation for radio-bound devices, where a large w is attractive because it shortens the signature. The two dials disagree, and the disagreement is the result.
The small probabilities needed a model, and the model needed validating twice. Sampling cannot resolve a one-in-a-million event at any practical trial count, so the curve rests on a closed-form random-oracle digit model. It is checked against Monte Carlo wherever Monte Carlo resolves, and against an exact conditional computation that includes the checksum coupling the model ignores. The model is accurate to 1–3%.
An apparent 0.64 to 0.97 disagreement between model and simulation looked like a flaw in the model and was not. The Monte Carlo's trials=300 meant 30 scenarios, because the loop read range(trials // 10): the parameter name hid a factor of ten, and the resulting ±33% sampling error was mistaken for model error. The loop now takes an explicit scenarios argument.

| scheme | W-OTS and a Merkle tree over it, not full XMSS or SPHINCS+ |
| implementation | Lamport, W-OTS and Merkle written from scratch on hashlib alone |
| cost metric | hash-function calls, not wall-clock, so ratios are meaningful and absolute times are not |
| model | random-oracle digit model, exact for w dividing 8 |
| validation | exact conditional computation, plus Monte Carlo where resolvable |
| shows | state-failure exposure is non-monotonic in w, and the selection rule that follows |
| does not show | full-scheme security proofs, or the behaviour of real stateful signers under real fault conditions |
pip install -r requirements.txt
python experiment.py # Lamport, W-OTS, Merkle, size and cost
python experiment_statereuse.py # how fast key reuse becomes forgery
python experiment_analytic.py # closed-form model and its validation
| script | runtime | outputs |
|---|---|---|
experiment.py | ~60 s | results.json, figure_pqc.png |
experiment_statereuse.py | ~2 min | results_statereuse.json, figure_statereuse.png |
experiment_analytic.py | ~3 min | results_analytic.json, figure_analytic.png |
CPU only, no download. Pure hashlib, no cryptographic library.
The complete report, with the derivation of the model, the exact conditional computation and the size-versus-exposure selection rule, is in report.pdf. The architecture diagram is also available as architecture.pdf. The report’s closing section states the limitations of every result in full.
Plots produced by the experiment scripts in this folder, referenced from the full report.


