What does Password Entropy and Least Privilege conclude, in numbers, about “Throttling, Blocklists and Hash Prefixes: the Ceiling on Online Guessing”?
Answer: Without the prefix, a single guess succeeds with the top candidate's probability, 0.0314. Knowing a one-character prefix raises it to 0.1240, 3.9 times; two characters give 0.3041, 9.7 times; three give 0.6214, 19.8 times; four give 0.9463, 30.1 times. The column of mean bucket sizes explains why. With 20,000 candidates in 4,096 buckets, each bucket holds 4.9 on average; with 65,536 buckets, 0.3 on average, so a bucket nearly always holds a single candidate and the prefix is the answer.
Scope of the numbers: Its firms, accounts and probabilities are illustrative, and all calculations are generated by its programs; it is not personalised business, legal, financial or compliance advice, and its audit routine and tool never touch a real password. Chapter 6 uses minimum role covers and the recovery graph to show that the illustrative firm expects to lose 0.4972 accounts a year, and 0.1899 after hardening the main mailbox alone.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.0314, 0.1240, 0.3, 0.3041, 0.6214, 0.9463
| toy population N=20,000, Zipf s=0.8; one guess per account | ||||
| prefix h | buckets | mean size | lam1 given prefix | gain over lam1 |
| 1 | 16 | 1250.0 | 0.1240 | 3.9 |
| 2 | 256 | 78.1 | 0.3041 | 9.7 |
| 3 | 4,096 | 4.9 | 0.6214 | 19.8 |
| 4 | 65,536 | 0.3 | 0.9463 | 30.1 |
| no prefix: lam1 = 0.0314 | ||||
| demo prefix of sha1('cand-00001'): 5ff41 |
Show the full program
# Chapter 5. p52: what a hash-prefix breach query leaks.
# A breach-checking service is sent the first h hex digits of the
# password's SHA-1 and returns every leaked hash with that prefix, so
# the password itself never leaves the device. Li et al. (2019) showed
# that the prefix still helps a guessing attacker. Toy population: 20,000
# synthetic strings "cand-00001" and so on with Zipf s = 0.8 popularity
# (illustrative; no real password is used). An attacker who sees the
# prefix guesses the most popular candidate inside that bucket.
import hashlib
import math
from collections import defaultdict
N, S = 20_000, 0.8
cands = ["cand-{:05d}".format(i) for i in range(1, N + 1)]
w = [r ** (-S) for r in range(1, N + 1)]
z = math.fsum(w)
p = [x / z for x in w]
digest = [hashlib.sha1(c.encode("ascii")).hexdigest() for c in cands]
print("toy population N=20,000, Zipf s=0.8; one guess per account")
print("prefix h buckets mean size lam1 given prefix gain over lam1")
lam1 = p[0]
for h in (1, 2, 3, 4):
best = defaultdict(float)
for d, x in zip(digest, p):
key = d[:h]
if x > best[key]:
best[key] = x
got = math.fsum(best[k] for k in sorted(best))
print("{:<8d} {:>7,d} {:>9.1f} {:>17.4f} {:>13.1f}".format(
h, 16 ** h, N / 16 ** h, got, got / lam1))
print("no prefix: lam1 = {:.4f}".format(lam1))
print("demo prefix of sha1('cand-00001'): {}".format(digest[0][:5]))Single source and citation
Fan, Y. (2026). Password Entropy and Credential Stuffing, the Forced-Rotation Paradox and Least-Privilege Accounts for One-Person Firms (Version 1.0.0), Chapter 5: Throttling, Blocklists and Hash Prefixes: the Ceiling on Online Guessing. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-218 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026218,
author = {Fan, Yafu},
title = {Password Entropy and Credential Stuffing, the Forced-Rotation Paradox and Least-Privilege Accounts for One-Person Firms},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · The Forced-Rotation Paradox: Predictable Variants and an Overrated Attack Window
- Chapter 2 · The Entropy Ledger: log2(N^L), Random Long Passphrases and Complex Short Passwords
- Chapter 3 · Guessing under a Zipf Law: Why Shannon Entropy Overrates Human-Chosen Passwords
- Chapter 4 · The Credential-Stuffing Funnel: Reuse Rates, Breach Corpora and Second Factors
- Chapter 6 · The Permission Graph and its Minimum Cover: a One-Person Firm's Blast Radius
- Chapter 8 · The Permission-Matrix Audit Sheet: an Empirical Loop and a Falsification Plan