关于「转账回单:去重、图像哈希与先放行后抽查」,《零人工站群、支付防欺诈与现金流排队》给出的定量结论是什么?
结论:第一章证明只核对 4 位尾号在 119 单时就有一半的碰撞机会,累计 5,000 单后会误拒 0.3935 的诚实回单;感知哈希能认出重新保存的副本,却会把同一 App 的诚实回单误配;「先放行、后抽查」只有在被抓者失去抵押时才有威慑力,抵押为 200 时抽查 0.485 的订单即可。
数据口径:第四章用排队论与模拟显示,突发到达把单个工作进程的 T99 推到数十秒;平均负载 0.80 时,突发需要 4 个工作进程,或 3 个加限流(拒绝 0.0005 的请求)。 书中以标注框区分证据、16 段可运行的 Python 程序、史料与假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.3935, 119, 5000
| (1) P(some shared tail) among n orders | |
| k n | 50 n=100 n=500 n=5000 n for 0.5 |
| 4 | 0.1155 0.3914 1.0000 1.0000 119 |
| 6 | 0.0012 0.0049 0.1173 1.0000 1178 |
| 8 | 0.0000 0.0000 0.0012 0.1175 11775 |
| honest receipt flagged after M | 5,000 orders: |
| k | 4: 0.3935 |
| k | 6: 0.0050 |
| k | 8: 0.0000 |
| (2) P(Hamming distance <= d) for a 64-bit perceptual hash | |
| d unrelated same app re-saved copy | |
| 4 | 3.68e-14 0.0280 0.9569 |
| 6 | 4.51e-12 0.1365 0.9970 |
| 10 | 9.98e-09 0.6374 1.0000 |
| Reading: four-digit tails collide by the time a shop has | |
| taken 119 orders, and after 5,000 orders four honest | |
| receipts in ten would be refused. A perceptual hash finds | |
| re-saved copies but also matches honest receipts from the | |
| same app; neither replaces the full reference number. |
查看完整验算程序
# Chapter 1. [p01] Last-k-digit receipt checks and hash look-alikes.
# (1) A manual-payment site accepts a bank-transfer screenshot and
# stores only the last k digits of its reference number to stop reuse.
# If tails are uniform, among n honest orders the chance of at least
# one shared tail is 1 - prod_{i<n} (1 - i / 10^k) (birthday problem).
# After M accepted orders, a new honest receipt is wrongly flagged as
# "reused" with chance 1 - (1 - 10^-k)^M.
# (2) A 64-bit perceptual hash flags two images as the same receipt if
# they differ in at most d bits. For unrelated images, bits differ
# with chance 0.5; for two honest receipts made by the same banking
# app (same layout, different numbers) they differ with chance 0.15;
# a re-saved copy of one receipt differs with chance 0.03 per bit.
import math
def birthday(n, k):
p = 1.0
for i in range(n):
p *= 1 - i / 10 ** k
return 1 - p
def first_n(k, target=0.5):
n, p = 1, 1.0
while 1 - p < target:
p *= 1 - n / 10 ** k
n += 1
return n
def tail(d, q, bits=64):
return sum(math.comb(bits, i) * q ** i * (1 - q) ** (bits - i)
for i in range(d + 1))
if __name__ == "__main__":
print(" (1) P(some shared tail) among n orders")
print(" k n=50 n=100 n=500 n=5000 n for 0.5")
for k in (4, 6, 8):
row = [birthday(n, k) for n in (50, 100, 500, 5000)]
print(" {} {:11.4f} {:8.4f} {:8.4f} {:8.4f} {:10d}".format(
k, *row, first_n(k)))
print(" honest receipt flagged after M = 5,000 orders:")
for k in (4, 6, 8):
print(" k={}: {:.4f}".format(k, 1 - (1 - 10 ** -k) ** 5000))
print(" (2) P(Hamming distance <= d) for a 64-bit perceptual hash")
print(" d unrelated same app re-saved copy")
for d in (4, 6, 10):
print(" {:2d} {:11.2e} {:10.4f} {:15.4f}".format(
d, tail(d, 0.5), tail(d, 0.15), tail(d, 0.03)))
print("\nReading: four-digit tails collide by the time a shop has")
print("taken 119 orders, and after 5,000 orders four honest")
print("receipts in ten would be refused. A perceptual hash finds")
print("re-saved copies but also matches honest receipts from the")
print("same app; neither replaces the full reference number.")唯一数据源与引用
范雅福(Fan, Y.). (2026). 《零人工多站点容错架构、支付防欺诈状态机与被动现金流排队论》第 1 章「转账回单:去重、图像哈希与先放行后抽查」(版本 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090201
DOI: 10.5281/zenodo.24090201 · 阅读本章所在专著 · 5DL-B-075 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026075,
author = {Fan, Yafu},
title = {Zero-Touch Multi-Site Fault Tolerance, Payment Anti-Fraud State Machines and Passive Cashflow Queuing},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.24090201},
url = {https://doi.org/10.5281/zenodo.24090201}
}