关于「Zipf 分布下的猜测:香农熵为什么高估人选口令」,《口令熵与最小权限》给出的定量结论是什么?
结论:第三章在 Zipf 人群中说明,猜 10 次的成功率 0.0477 是同熵均匀分布的 817 倍;被拒用户若改用可预测变形,百条黑名单下猜 100 次的成功率 0.1336 反而高于不设黑名单的 0.1087。
数据口径:书中的公司、账户与概率参数均为示意,全部计算由书中程序生成;本书不是个性化的经营、法律、财务或合规建议,审计流程与小工具不接触任何真实口令。 第六章用最小角色覆盖与找回关系图说明,示意公司期望每年失守 0.4972 个账户,只加固主邮箱就降到 0.1899。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.0477, 0.1087, 10, 100, 817
| N | 1,000,000 distinct passwords, Zipf exponent s |
| s H(bits) Hmin lam10 lam100 lam1000 mu50(bits) H-mu50 | |
| 0.6 | 19.12 9.29 0.0071 0.0221 0.0602 17.44 1.68 |
| 0.8 | 17.39 6.23 0.0477 0.1087 0.2068 15.32 2.06 |
| 1.0 | 13.41 3.85 0.2035 0.3604 0.5201 9.55 3.86 |
| uniform with the same H | 17.39 bits: lam10 = 0.000058 |
| Zipf s | 0.8 lam10 is 817 times the uniform value |
查看完整验算程序
# Chapter 3. p31: Shannon entropy versus guessing under a Zipf law.
# Human-chosen passwords follow a Zipf-like rank-frequency law (Wang et
# al. 2017: 14 data sets, 113.3 million passwords; the PDF-Zipf fit to
# popular passwords has R^2 above 0.97): p_r proportional to r^(-s).
# Here N = 1,000,000 distinct passwords and s in {0.6, 0.8, 1.0} are
# illustrative. Metrics
# (Bonneau 2012): Shannon H; min-entropy Hmin = -log2 p_1; success rate
# lambda_k of an attacker who tries the k most common passwords; mu_50,
# the guesses needed to break half the accounts, in bits. A uniform
# distribution with the same Shannon H would need 2^(H-1) guesses.
import math
N = 1_000_000
def zipf(s, n=N):
w = [r ** (-s) for r in range(1, n + 1)]
z = math.fsum(w)
return [x / z for x in w]
def guesses_for(p, target):
"""Smallest k whose top-k mass reaches target (binary search)."""
lo, hi = 1, len(p)
while lo < hi:
mid = (lo + hi) // 2
if math.fsum(p[:mid]) >= target:
hi = mid
else:
lo = mid + 1
return lo
def metrics(p):
h = -math.fsum(x * math.log2(x) for x in p)
hmin = -math.log2(p[0])
lam = {k: math.fsum(p[:k]) for k in (10, 100, 1000)}
return h, hmin, lam, guesses_for(p, 0.5)
print("N = 1,000,000 distinct passwords, Zipf exponent s")
print("s H(bits) Hmin lam10 lam100 lam1000 mu50(bits) H-mu50")
for s in (0.6, 0.8, 1.0):
h, hmin, lam, half = metrics(zipf(s))
mb = math.log2(half)
print("{:.1f} {:6.2f} {:5.2f} {:.4f} {:.4f} {:.4f} {:9.2f} {:6.2f}"
.format(s, h, hmin, lam[10], lam[100], lam[1000], mb, h - mb))
if s == 0.8:
ref = (h, lam[10])
print("uniform with the same H = {:.2f} bits: lam10 = {:.6f}".format(
ref[0], 10 / 2.0 ** ref[0]))
print("Zipf s=0.8 lam10 is {:,.0f} times the uniform value".format(
ref[1] / (10 / 2.0 ** ref[0])))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《口令熵与撞库攻击、强制改密反安全悖论与一人公司账号最小权限母典》第 3 章「Zipf 分布下的猜测:香农熵为什么高估人选口令」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 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}
}