二维码为什么坏了还能扫?原理与安全扫码建议Why Do Damaged QR Codes Still Scan? How They Work and Safe-Scanning Tips
二维码被折角、沾水、贴了 Logo 依然能扫,背后是纠错码在发挥作用。本文讲清二维码的存储与纠错原理,并给出日常扫码的安全建议。QR codes survive folded corners, water stains and logos thanks to error correction. This article explains how QR codes store data and correct errors, plus practical safe-scanning advice.
二维码如何存储信息How a QR code stores information
二维码本质是一张黑白矩阵:黑白模块代表 0/1,三个角上的“回”字形方块是定位图案,让扫描器无论从哪个角度都能确定方向与比例。内容越长,矩阵越密(版本越高),目前最大版本可容纳数千字符或上千字节二进制。A QR code is a black-and-white matrix: modules encode 0/1, and the three corner "finder" squares let a scanner determine orientation and scale from any angle. Longer content means a denser matrix (higher version); the largest versions hold thousands of characters.
扫码过程则是拍照 → 定位 → 按规则读取模块 → 纠错解码 → 得到文本或链接。整个过程在本地毫秒级完成。Scanning is: capture → locate → read modules per the spec → error-correct and decode → yield text or a link, all locally in milliseconds.
纠错等级:破损与 Logo 的秘密Error correction: the secret behind damage and logos
二维码在编码时加入了 Reed–Solomon 纠错冗余,分为 L/M/Q/H 四个等级,可恢复约 7%–30% 的损坏面积。这就是折角、污渍甚至中间贴 Logo 后仍能扫通的原因——Logo 本质是“被设计好的损坏”。QR encoding adds Reed–Solomon redundancy at four levels (L/M/Q/H), recovering roughly 7%–30% of damage. That is why folded corners, stains — even a centred logo — still scan: a logo is simply "designed damage".
生成用于印刷物料的二维码时建议选 Q 或 H 级;屏幕展示、内容较长时可选 M 级以控制密度。等级越高冗余越多,图案也越密,需要在“耐损”与“易扫”间平衡。For printed material choose Q or H; for on-screen display with long content, M keeps the matrix manageable. Higher levels add redundancy and density, so balance durability against scannability.
安全扫码的三条建议Three safe-scanning habits
第一,扫完先看链接再行动:确认域名是否为官方域名,警惕形近域名(如 go0gle.com)。第二,警惕“覆盖贴”:路边单车、缴费单上被另贴一张二维码的,可能是收款劫持。第三,扫码后要求“输入密码、下载 App、开启屏幕共享”的,一律按诈骗处理。One, inspect the link before acting: verify the domain is official and watch for look-alikes (go0gle.com). Two, beware "overlay stickers" on shared bikes or payment sheets — a pasted-over QR may hijack the payment. Three, treat any post-scan demand for passwords, app installs or screen sharing as fraud.
二维码只是入口,风险在入口之后的网页与流程。保持“先看地址、再给权限”的习惯,就能避开绝大多数二维码诈骗。A QR code is only an entry point; the risk lives in the pages and flows behind it. "Check the address, then grant permissions" defeats most QR scams.