Fareeha20Amir's picture
Static site: report, figures and sources
9cdd97b verified
Raw History Blame Contribute Delete
7.06 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Two Dials That Disagree · Research Projects</title>
<meta name="description" content="Research project: Two Dials That Disagree">
<link rel="stylesheet" href="assets/style.css">
</head>
<body style="--accent:var(--ink-c)">
<div class="topbar"><div class="topbar-inner">
<a class="back" href="../">← All projects</a>
<nav></nav>
</div></div>
<div class="container hero">
<h1>Two Dials That Disagree</h1>
<div class="downloads"><a class="dl-btn" href="report.pdf">Full report (PDF)</a><a class="dl-btn" href="architecture.pdf">Architecture diagram (PDF)</a><a class="dl-btn" href="README.md">Raw README (Markdown)</a></div>
</div><div class="container content"><p><em>Winternitz parameter selection for signature size and for the blast radius of state failure.</em></p>
<p>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 <code>w</code> 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.</p>
<p><img src="architecture.png" alt="Architecture diagram" loading="lazy"></p>
<h3 id="the-question">The question</h3>
<p>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.</p>
<p>The attacker modelled here does no cryptanalysis at all. They hash forward from values the signer has already published, which is a public operation.</p>
<h3 id="what-it-found">What it found</h3>
<p><strong>The blast-radius curve.</strong> Forgeable fraction against the number of times a key is reused:</p>
<div class="table-wrap"><table><thead><tr><th>reuses</th><th>forgeable fraction</th></tr></thead><tbody><tr><td>1–4</td><td>below Monte-Carlo resolution</td></tr><tr><td>5</td><td>1 in 12,000</td></tr><tr><td>6</td><td>1 in 2,400</td></tr><tr><td>7</td><td>1 in 750</td></tr><tr><td><strong>8</strong></td><td><strong>1 in 185</strong></td></tr></tbody></table></div>
<p><strong>Exposure is non-monotonic in <code>w</code>, and the extremes are the worst choices.</strong> At four reuses, forgeability is <strong>1.902e−06</strong> at <code>w = 2</code> and <strong>5.942e−04</strong> at <code>w = 8</code>, making <code>w = 8</code> about <strong>312×</strong> more exposed. That is the opposite of the size-driven recommendation for radio-bound devices, where a large <code>w</code> is attractive because it shortens the signature. The two dials disagree, and the disagreement is the result.</p>
<p><strong>The small probabilities needed a model, and the model needed validating twice.</strong> 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 <strong>1–3%</strong>.</p>
<p>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 <code>trials=300</code> meant <strong>30</strong> scenarios, because the loop read <code>range(trials // 10)</code>: 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 <code>scenarios</code> argument.</p>
<p><img src="figure_statereuse.png" alt="Exposure against the Winternitz parameter" loading="lazy"></p>
<h3 id="scope">Scope</h3>
<div class="table-wrap"><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>scheme</strong></td><td>W-OTS and a Merkle tree over it, <strong>not</strong> full XMSS or SPHINCS+</td></tr><tr><td><strong>implementation</strong></td><td>Lamport, W-OTS and Merkle written from scratch on <code>hashlib</code> alone</td></tr><tr><td><strong>cost metric</strong></td><td>hash-function calls, not wall-clock, so ratios are meaningful and absolute times are not</td></tr><tr><td><strong>model</strong></td><td>random-oracle digit model, exact for <code>w</code> dividing 8</td></tr><tr><td><strong>validation</strong></td><td>exact conditional computation, plus Monte Carlo where resolvable</td></tr><tr><td><strong>shows</strong></td><td>state-failure exposure is non-monotonic in <code>w</code>, and the selection rule that follows</td></tr><tr><td><strong>does not show</strong></td><td>full-scheme security proofs, or the behaviour of real stateful signers under real fault conditions</td></tr></tbody></table></div>
<h3 id="running-it">Running it</h3>
<pre><code>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</code></pre>
<div class="table-wrap"><table><thead><tr><th>script</th><th>runtime</th><th>outputs</th></tr></thead><tbody><tr><td><code>experiment.py</code></td><td>~60 s</td><td><code>results.json</code>, <code>figure_pqc.png</code></td></tr><tr><td><code>experiment_statereuse.py</code></td><td>~2 min</td><td><code>results_statereuse.json</code>, <code>figure_statereuse.png</code></td></tr><tr><td><code>experiment_analytic.py</code></td><td>~3 min</td><td><code>results_analytic.json</code>, <code>figure_analytic.png</code></td></tr></tbody></table></div>
<p>CPU only, no download. Pure <code>hashlib</code>, no cryptographic library.</p>
<h3 id="full-write-up">Full write-up</h3>
<p>The complete report, with the derivation of the model, the exact conditional computation and the size-versus-exposure selection rule, is in <strong><a href="report.pdf">report.pdf</a></strong>. The architecture diagram is also available as <a href="architecture.pdf">architecture.pdf</a>. The report’s closing section states the limitations of every result in full.</p><h2 id="result-figures">Result figures</h2><p>Plots produced by the experiment scripts in this folder, referenced from the full report.</p><div class="figs"><figure class="fig-card"><img src="figure_analytic.png" alt="Analytic" loading="lazy"><figcaption>Analytic</figcaption></figure><figure class="fig-card"><img src="figure_pqc.png" alt="Pqc" loading="lazy"><figcaption>Pqc</figcaption></figure><figure class="fig-card"><img src="figure_statereuse.png" alt="Statereuse" loading="lazy"><figcaption>Statereuse</figcaption></figure></div></div><footer><div class="container">
Nine research projects &middot; built as static pages from each project's README.
</div></footer>
</body>
</html>