Research date: 2026-12-03. Every fact carries a source and one of two tags:
- [verified]: I fetched the source and read the passage myself, either the page, the PDF text or the source code.
- [unverified]: this comes from memory or from a search-engine snippet I did not open. Treat it as a lead, not a fact.
"Analysis" lines are my own arithmetic or inference from the verified facts, not claims made by a source.
1. Can arbitrary binary survive a QR scan on mainstream platforms?
Bottom line. Binary in byte mode can be recovered on iOS, Android and with the main open-source decoders, but only through low-level, opt-in accessors. Several of these hand back the raw codeword stream, so the app has to parse mode and length headers itself. Every high-level, text-oriented path loses or mangles bytes that are not valid text: the string APIs, the web BarcodeDetector, the built-in camera apps, and hardware "keyboard-wedge" scanners. A digits-only numeric segment comes through every path as the same ASCII string. Its density cost compared with byte mode is about 0.3% with one big-integer conversion and about 1.2% with 7-byte→17-digit blocks, so digits-only is the robust choice and byte mode buys almost nothing. Do not use ECI: Google ML Kit says it does not recognise QR codes generated in ECI mode.
iOS / macOS
AVMetadataMachineReadableCodeObject.stringValue(iOS 7+) is "an NSString created by decoding the binary payload according to the format of the machine-readable code, or nil if a string representation cannot be created." So binary that is not valid text comes back as nil. [verified] https://developer.apple.com/documentation/avfoundation/avmetadatamachinereadablecodeobject/stringvalue (read via the JSON at https://developer.apple.com/tutorials/data/documentation/avfoundation/avmetadatamachinereadablecodeobject/stringvalue.json)AVMetadataMachineReadableCodeObject.descriptor(iOS 11+) returns aCIBarcodeDescriptor; for QR codes this is aCIQRCodeDescriptor. [verified] https://developer.apple.com/tutorials/data/documentation/avfoundation/avmetadatamachinereadablecodeobject/descriptor.jsonCIQRCodeDescriptor.errorCorrectedPayload(iOS 11+, macOS 10.13+) is defined as the 8-bit codeword sequence after error correction, "immediately prior to splitting the message into blocks" (ISO/IEC 18004 §6.4.10). In other words it is the raw bitstream, mode indicators and character counts included, not the decoded data. [verified] https://developer.apple.com/tutorials/data/documentation/coreimage/ciqrcodedescriptor/errorcorrectedpayload-swift.property.json- Vision
VNBarcodeObservation.payloadDatais "The raw data representation of the barcode's payload", available on iOS 17+ and macOS 14+.payloadStringValue(iOS 11+) notes that "a string representation of the payload may not be available." The newer SwiftBarcodeObservation(iOS 18+) haspayloadDataandpayloadStringwith the same wording. [verified] https://developer.apple.com/tutorials/data/documentation/vision/vnbarcodeobservation/payloaddata.json, …/payloadstringvalue.json, …/vision/barcodeobservation/payloaddata.json - Apple does not document whether
payloadDatacontains the decoded segment bytes or the raw codewords with headers. Third-party wrappers say it includes headers and padding. [unverified] (search snippets: https://pub.dev/documentation/custom_ai_barcode_scanner/7.1.0/ai_barcode_scanner/DecodedVisionBarcodeBytes-class.html) - Signal for iOS shows binary QR working in production. It reads
errorCorrectedPayloadandsymbolVersionfrom theCIQRCodeDescriptorand runs its ownQRCodePayload.parse, which handles only a single byte-mode segment. Its comments say: "If a QR code contains Kanji, for example, a String payload will be present (parsed by iOS) but not a Data payload." [verified] https://github.com/signalapp/Signal-iOS/blob/main/SignalUI/ViewControllers/ScanQRCodeViewController.swift - iOS Camera app: scanning a
shc:/…code before Apple added SMART Health Card support showed "QR Code Detected / No usable data found", because no handler was registered for theshc:scheme (FHIR chat, 21 May 2021). [verified] https://chat-archive.fhir.org/stream/284830-smart/health-cards/topic/iPhone.20camera.20No.20Usable.20Data.html - Since iOS 15.1 the iPhone Camera app handles SMART Health Card QR codes and offers them to Health and Wallet; EU DCC support came in iOS 15.4. Apple's web button flow replaces
shc:/withhttps://redirect.health.apple.com/SMARTHealthCard/#and says "The long string of numbers after shc:/ must not be modified". Apple recommends a minimum QR size of 40 mm. [verified] https://developer.apple.com/health-fitness/add-to-apple-wallet-and-health-guidelines - I found no report of a length limit or failure in the iOS or Android camera apps for long digit strings after
shc:/. Real SHC codes run to about 2,390 digits, which suggests long digit runs are fine. This is absence of evidence, not a test. [unverified]
Android
- ML Kit
Barcode.getRawBytes(): "Returns raw bytes as it was encoded in the barcode. Returns null if the raw bytes can not be determined."getRawValue(): "It's only available when the barcode is encoded in the UTF-8 format, and for non-UTF8 ones use getRawBytes() instead." [verified] https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/common/Barcode - Whether
getRawBytes()returns the segment payload or the codeword stream with headers is not documented. [unverified] - ML Kit lists "QR codes generated in the ECI mode" among the codes the API does not recognise. [verified] https://developers.google.com/ml-kit/vision/barcode-scanning
- ML Kit input guidance: "the smallest meaningful unit of the barcode should be at least 2 pixels wide" (and tall, for 2D codes), with 1280x720 or 1920x1080 recommended. [verified] https://developers.google.com/ml-kit/vision/barcode-scanning/android
- CameraX's ML Kit analyzer returns the same ML Kit
Barcodeobjects, and zxing-android-embedded returns ZXingResults (see below). [unverified]
Web
- Shape Detection API:
DetectedBarcode.rawValueis a requiredDOMString, "String decoded from the barcode". The spec has no raw-bytes accessor and does not say which character encoding is used. [verified] https://wicg.github.io/shape-detection-api/ - MDN marks the Barcode Detection API as "Limited availability" and "Experimental": "not Baseline because it does not work in some of the most widely-used browsers." [verified] https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API
- jsQR returns
binaryData("The raw bytes of the QR code") anddata(the string). In the source, byte-mode text is decoded as UTF-8 viadecodeURIComponent, and invalid UTF-8 gives empty text.bytesaccumulates the bytes of every segment, with numeric digits pushed as ASCII codes. SobinaryDataholds the payload bytes concatenated across segments, not the codewords. [verified] https://github.com/cozmo/jsQR (README) and https://github.com/cozmo/jsQR/blob/master/src/decoder/decodeData/index.ts - zxing-js (
@zxing/library) carries the sameBYTE_SEGMENTSmetadata key as ZXing Java. [verified] https://github.com/zxing-js/library/blob/master/src/core/ResultMetadataType.ts
ZXing, zxing-cpp, zbar
- ZXing Java
ResultMetadataType.BYTE_SEGMENTSis documented as: "2D barcode formats typically encode text, but allow for a sort of 'byte mode' which is sometimes used to encode binary data. While Result makes available the complete raw bytes in the barcode for these formats, it does not offer the bytes from the byte segments alone. … This maps to a List of byte arrays corresponding to the raw bytes in the byte segments." [verified] https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/ResultMetadataType.java - ZXing
DecodedBitStreamParser.decodeByteSegmentguesses the charset when no ECI is present. Its comment reads: "The spec isn't clear on this mode … I have seen ISO-8859-1 used as well as Shift_JIS -- without anything like an ECI designator".StringUtils.guessCharsetreturns UTF-8 if the bytes are valid multibyte UTF-8. Otherwise it picks Shift_JIS by a katakana or "10% high bytes" heuristic, or by platform default, and then ISO-8859-1, and as a last resort the platform default. So the text result for random binary depends on a heuristic and on the platform locale. [verified] https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/qrcode/decoder/DecodedBitStreamParser.java, https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/common/StringUtils.java - The ZXing maintainer (Sean Owen, on the zxing Google Group) pointed users to
Result.getRawBytes()and said "Byte mode" is a misleading name because the spec expects the bytes to be read as text in some encoding. A later poster found that the raw bytes include QR headers, so extracting the payload means reimplementing parts ofDecodedBitStreamParser. [verified] https://groups.google.com/g/zxing/c/rhKP0bsmyHM - zxing-cpp has
bytes()("the raw / standard content without any modifications like character set conversions"),bytesECI()andtext(). [verified] https://github.com/zxing-cpp/zxing-cpp/blob/master/core/src/Barcode.h - zbar QR text decoding without ECI: Kanji present → SJIS; UTF-8 BOM → UTF-8; pure ASCII → UTF-8; Big5 heuristic; then it tries a list of encodings including ISO-8859-1. A comment notes that the 2005 ISO 18004 edition makes ISO-8859-1 the default, while the 2000 edition used JIS8/SJIS. With
ZBAR_CFG_BINARYset, zbar copies the bytes unchanged. [verified] https://github.com/mchehab/zbar/blob/master/zbar/qrcode/qrdectxt.c - In
zbarimg,-Sbinarysets the decoder's binary config and turns off the type-prefixed output.--rawonly turns off the prefixed/XML output. Its help text says "without converting charsets", but in the source the charset conversion is controlled by the binary config. Usezbarimg --raw -Sbinary(or-Sqrcode.binary) for exact bytes. [verified] https://github.com/mchehab/zbar/blob/master/zbarimg/zbarimg.c
ECI and charset guessing in specifications and practice
- RFC 9285 (Base45) states the problem directly: "Even in Byte mode, a typical QR code reader tries to interpret a byte sequence as text encoded in UTF-8 or ISO/IEC 8859-1. Thus, QR codes cannot be used to encode arbitrary binary data directly." [verified] https://www.rfc-editor.org/rfc/rfc9285.txt
- Blockchain Commons UR has a design goal to "Avoid the use of QR code binary mode to support transparency and wide compatibility with QR code reader libraries", saying binary mode is "not consistently supported by readers". [verified] https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-005-ur.md
- SeedSigner's SeedQR documentation compares a numeric format (Standard SeedQR) with a byte-mode format (CompactSeedQR). It reports: "Most QR readers today assume the data is either alphanumeric or human-readable numeric data" and "misinterpret the binary format data". zxing "may return more data than the compact seed itself" (header, length and padding).
\x00is "a particularly troublesome character for most QR readers", and test vectors cover\nand\r. [verified] https://github.com/SeedSigner/seedsigner/blob/dev/docs/seed_qr/README.md - ICAO says the binary-encoded VDS is hard for deployed travel and border scanners. The VDS-NC (JSON) was designed to be "easily readable with barcode scanners deployed in travel/border environment, therefore avoiding reading problems with binary barcodes." [verified] ICAO presentation, https://www.icao.int/sites/default/files/APAC/Meetings/2021/2021%20ACCRPG10/5-Presentations/4.1_Rajesh-VDS-NC_ACCRPG_10.pdf
- A synthetic benchmark of four Go encoders and four Go decoders reported a 52.4% failure rate (decode failure or data mismatch) for "binary" content against 15.7% for UTF-8. The benchmark is synthetic, Go-only, and does not explain the cause, so give it little weight. [verified] https://13rac1.github.io/qr-benchmarks/failures, https://github.com/13rac1/qr-benchmarks
Analysis. Byte mode with binary content needs a platform-specific raw path everywhere: iOS errorCorrectedPayload plus your own segment parser (as Signal does), Android getRawBytes(), ZXing BYTE_SEGMENTS, zbar -Sbinary, jsQR binaryData. It does not work at all through BarcodeDetector.rawValue, camera apps, OS share sheets, copy and paste, or keyboard-wedge scanners. A digits-only segment comes back byte-identical as text on every one of those paths. A verifier with only a text API can still decode it. And it composes with URL redirects such as Apple's https://redirect.health.apple.com/SMARTHealthCard/#<digits>.
2. Prior art for dense encodings in QR and other 2D codes
Bottom line. Two deployed credential systems already convert binary to decimal for QR numeric mode. India's Aadhaar Secure QR encodes the entire compressed and signed byte array as one big integer in base 10. UIDAI's spec says to "Convert the base10 value of Secure QR code into Big Integer", then to a byte array, then decompress. SMART Health Cards uses a fixed 6-bit-per-character → 2-digit mapping, at about 90% of numeric capacity. The EU DCC chose zlib + Base45 + alphanumeric mode at ECC level Q. I found no deployed credential that uses block decimal conversion (for example 7 bytes → 17 digits); SeedQR's 11-bit → 4-digit word mapping is the nearest small-block example.
- India Aadhaar Secure QR (UIDAI spec, March 2019, "Version 0"). The data is ISO-8859-1 text fields separated by byte 255, followed by a JPEG 2000 photo with no delimiter, an optional 32-byte SHA-256 hash of the email and one of the mobile number, and a fixed 256-byte signature at the end, verified with "SHA256withRSA". Validation steps: "Convert the base10 value of Secure QR code into Big Integer. Convert the Big Integer into byte array. Decompress the byte array." The sample data in the spec is one long decimal integer. [verified] https://web.archive.org/web/2020/https://uidai.gov.in/images/resource/User_manulal_QR_Code_15032019.pdf (the original uidai.gov.in URL now returns 404)
- The spec does not name the compression format. Community decoders use gzip (
zlibwithwbits=16+MAX_WBITS) and report "Decompression failed" errors. [unverified] (search snippets: https://pypi.org/project/pyaadhaar, https://github.com/rajdeol/android-aadhaar-card-scanner/blob/master/app/src/main/java/com/rajdeol/aadhaarreader/utils/SecureQrCode.java) - Whether the printed symbol actually uses QR numeric mode is not stated in the spec; the payload is a decimal string, so any optimising encoder would choose numeric. [unverified]
- Analysis: a plain big-integer conversion loses leading zero bytes. Aadhaar avoids this implicitly because a gzip stream starts with 0x1F. A new design should fix the length or add a non-zero sentinel or prefix byte.
- The spec does not name the compression format. Community decoders use gzip (
- SMART Health Cards. The QR has a byte-mode segment
shc:/followed by a numeric segment. Each JWS character c becomes two digits,Ord(c)-45. Rationale from the spec: "with Numeric Mode, 20% more data can fit in a given QR, vs Binary Mode… the JWS character set conveys only log_2(65) bits per character (~6 bits)". Chunking is deprecated as of December 2022 because it was not widely adopted. [verified] https://spec.smarthealth.cards/ and https://github.com/smart-on-fhir/health-cards/blob/main/docs/index.md - EU DCC / HCERT 1.0.8. The payload is a CWT (CBOR/COSE), "SHALL be compressed using ZLIB", then Base45 with the
HC1:prefix. "An error correction rate of 'Q' (around 25%) is RECOMMENDED. The Alphanumeric (Mode 2…) MUST be used in conjunction with Base45." The Base45 choice is explained as "to better handle legacy equipment designed to operate on ASCII payloads". [verified] https://github.com/ehn-dcc-development/hcert-spec/blob/main/hcert_spec.md - RFC 9285 (Base45). Two bytes become three characters from a 45-character alphabet. Implementations MUST reject triplets above 65535 and characters outside the alphabet. The output is not URL-safe (it contains space,
%,/,:and so on). [verified] https://www.rfc-editor.org/rfc/rfc9285.txt - ICAO VDS (Doc 9303 Part 13). The VDS defines a byte stream (header, message zone of TLV features, signature zone) for any ISO 2D symbology: DataMatrix, Aztec or QR. Alphanumeric fields are packed with C40, three characters per 16 bits:
U = 1600·U1 + 40·U2 + U3 + 1. Binary fields are "taken as they are". The module size is RECOMMENDED to be at least 0.3386 mm (4 dots at 300 dpi). The document also states: "cryptographic agility is not supported." [verified] https://www.icao.int/sites/default/files/publications/DocSeries/9303_p13_cons_en.pdf - ICAO VDS-NC. This uses an I-JSON payload in a QR code. It was created because the binary VDS caused "reading problems with binary barcodes" on deployed scanners. [verified] ICAO presentation (URL in Section 1)
- France 2D-Doc (ANTS). It has a header zone and a data zone with two-character data identifiers, separated by GS/US characters, and a Base32-encoded signature at the end. [verified] https://docs.scandit.com/data-capture-sdk/ios/parser/french2ddoc.html (a third-party parser's documentation, not the ANTS specification)
- The carrier is DataMatrix with C40 encoding. [unverified]
- Swiss QR-bill (SIX Implementation Guidelines v2.3). It uses error correction level "M". At most 997 characters, which "with error correction level 'M' and binary coding is version 25 with 117 x 117 modules". The minimum printed module size is 0.4 mm, and the code is always printed at 46 × 46 mm. The character set is a UTF-8 subset (Basic Latin, Latin-1 Supplement, Latin Extended-A and others). [verified] https://www.six-group.com/dam/download/banking-services/standardization/qr-bill/ig-qr-bill-v2.3-en.pdf
- GS1 Digital Link. A compressed URI form uses EPC binary syntax with
eh(hex) orexflags. The older "legacy" compression algorithm "will not be maintained after version 1.1.4" and is "not approved for use in open supply chain standards". [verified] https://ref.gs1.org/standards/digital-link/uri-syntax/ - IATA BCBP. The data is fixed-width ASCII fields in PDF417, Aztec or QR, with an optional security or signature field. [unverified] (from memory)
- PathCheck Verifiable QR (paper-cred, 2021 draft). Upper-case
CRED:TYPE:VERSION:SIGNATURE:KEYID:PAYLOAD, with a DER signature in Base32 without padding, chosen for alphanumeric mode ("Extremely small QR Sizes in Alphanumeric"; "Smaller QR codes will be scannable with older hardware"). [verified] https://github.com/bloodyfingers/paper-cred/blob/main/README.md (a fork of the PathCheck repository) - SeedSigner SeedQR. Standard SeedQR is digits only: each BIP-39 word index is zero-padded to four digits, which is an 11-bit → 4-digit block mapping and the closest small-block decimal example I found. CompactSeedQR is raw bytes in byte mode, and the project documents the reader problems that come with it (cited in Section 1). [verified] https://github.com/SeedSigner/seedsigner/blob/dev/docs/seed_qr/README.md
- Blockchain Commons UR. Binary goes to Bytewords, then upper case, for alphanumeric mode. The explicit reason is to avoid binary mode (cited in Section 1). [verified] https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-005-ur.md
Lessons reported:
- ICAO had to create VDS-NC because binary barcodes were hard for field scanners.
- SHC chunking was little used and is now deprecated.
- SHC's
shc:scheme showed "No usable data" in the iOS camera until Apple added explicit support. - RFC 9285 and UR both justify text encodings by unreliable binary reading.
3. Practical scannability limits
Bottom line. None of the sources gives a rigorous curve relating QR version, print size and phone scan rate. Each standard instead sets a physical floor:
- SHC: V22 (105 modules) at 40 mm, about 0.38 mm per module.
- Apple: 40 mm minimum.
- Swiss QR-bill: V25 at 46 mm with a 0.4 mm minimum module.
- ICAO: at least 0.3386 mm per module.
- EU DCC: 35–60 mm diagonal.
Level L is not the usual choice. Denso Wave says M is most common, EU DCC recommends Q, and Swiss QR-bill requires M. SHC never states a level, but its 1,195-character single-QR limit is the level-L figure, so SHC in effect relies on L.
- SHC: "We aim to ensure that printed (or electronically displayed) codes are usable at physical dimensions of 40mmx40mm. This constraint allows us to use QR codes up to Version 22, at 105x105 modules." No measurement study is cited. [verified] https://spec.smarthealth.cards/
- SHC QR FAQ: the maximum JWS length for V22 is L 1195 / M 927 / Q 670 / H 519 characters, derived from data capacities of 8048 / 6256 / 4544 / 3536 bits. [verified] https://github.com/smart-on-fhir/health-cards/blob/main/FAQ/qr.md
- The HL7 SHC&L FAQ advises against logos inside the QR because SHCs "often hold a large amount of data compared to other QR codes". [verified] https://hl7.org/fhir/uv/smart-health-cards-and-links/frequently-asked-questions.html
- EU DCC: ECC "Q" RECOMMENDED; "rendered on the presentation media with a diagonal size between 35 mm and 60 mm to accommodate readers with fixed optics". When printing below 300 dpi, keep every module exactly square, because non-proportional scaling "will hamper readability". [verified] https://github.com/ehn-dcc-development/hcert-spec/blob/main/hcert_spec.md
- Apple: "The recommended minimum QR code size for optimum scanning is 40 mm for each dimension." [verified] https://developer.apple.com/health-fitness/add-to-apple-wallet-and-health-guidelines
- Denso Wave (qrcode.com): "Level Q or H may be selected for factory environment where QR Code get dirty, whereas Level L may be selected for clean environment with the large amount of data. Typically, Level M (15%) is most frequently selected." [verified] https://www.qrcode.com/en/about/error_correction.html
- Denso Wave sizing method: symbol size = modules × module size. In their example, 400 dpi × 4 dots per module gives 0.254 mm per module, with a 4-module quiet zone. No phone or camera guidance. [verified] https://www.qrcode.com/en/howto/code.html
- Swiss QR-bill: level M, V25 maximum, 0.4 mm minimum module, 46 × 46 mm, generate at the smallest version and then scale. [verified] (SIX v2.3, URL in Section 2)
- ICAO: module size at least 0.3386 mm with inkjet printers; take ISO/IEC 15415 into account for print quality. [verified] (ICAO 9303 Part 13, URL in Section 2)
- ML Kit: at least 2 px per module; 1280x720 or 1920x1080 frames recommended. [verified] (URL in Section 1)
- Empirical studies:
- A 2014 study with seven phones from 2008–2012 found a minimum module size of 0.52 mm, excluding the iPhone 3G. Modern phones would do better.
- A 2024 egocentric-camera study (arXiv 2410.05497) found that most failures came from codes that were "small and dense".
- I did not open either study. [unverified] https://hrcak.srce.hr/file/203711, https://arxiv.org/pdf/2410.05497
- ISO/IEC 18004 itself is paywalled; I did not read it. [unverified]
Analysis:
- Module pitch at the reference sizes: SHC 40 mm / 105 = 0.381 mm; Swiss 46 mm / 117 = 0.393 mm. Both are near ICAO's 0.339 mm print floor.
- Only the change from L to M, Q or H changes the module count at a fixed payload. At V22, going from L to M cuts capacity by 22%.
- For on-screen display, the ML Kit 2-px floor means a V22 symbol with its quiet zone (113 modules) needs at least about 226 camera pixels across.
4. Prior art for "the decoder ships as code"
Bottom line. Two 2025 database papers, F3 (SIGMOD) and AnyBlox (VLDB), ship WebAssembly decoders with columnar data. Both run them in Wasmtime with a narrow pointer-and-length ABI and Arrow as the output format. Neither specifies fuel or time limits, determinism rules, or a signing or trust model beyond a checksum, a URI, or "register in a central repository" as future work. The IPLD/Kubo experiment with Wasm codecs did use fuel. Its reviewers raised the key interoperability problem: different limits mean data "could load in one implementation but not another". They also asked for a deterministic interpreter with no I/O. The Wasm 3.0 core spec now defines a deterministic profile, which canonicalises NaNs and fixes relaxed SIMD. memory.grow and resource exhaustion remain nondeterministic, so a codec spec must fix the limits itself.
Data formats with embedded Wasm decoders
-
F3 (Zeng, Meng, Prammer, McKinney, Patel, Pavlo, Zhang; Proc. ACM Manag. Data 3(4), Sept 2025, SIGMOD).
- "Each self-describing F3 file includes both the data and meta-data, as well as WebAssembly (Wasm) binaries to decode the data."
- Native decoders are preferred and Wasm is the fallback.
- Decoder API:
check(metadata) -> features,init(encunit bytes, kwargs) -> *Decoder, then repeated decode calls into Arrow arrays. - Runs in Wasmtime.
- Safety rests on the Wasm sandbox ("at worst, only the isolated 4 GB of linear memory is affected").
- Security future work: side channels, and "creators of Wasm decoding kernels … register their Wasm modules in a central repository to get the Wasm modules verified and tamper-resistant."
- A Wasm-binary checksum is used to cache AOT compilation.
- Custom encodings added about 150 KB of Wasm.
- The repository is labelled a research prototype.
[verified] https://db.cs.cmu.edu/papers/2025/zeng-sigmod2025.pdf, https://github.com/future-file-format/F3
-
AnyBlox (Gienieczko, Kuschewski, Neumann, Leis, Giceva; PVLDB 18(11) 2025). Self-decoding datasets made of Wasm decoder bytecode plus data.
- ABI:
decode_batch(data, data_length, start_tuple, tuple_count, state, projection), with output as Arrow. - The decoder "has no access outside of the sandbox aside from the memory.grow call. It is prohibited from modifying the pages containing the encoded data. Wasmtime catches any runtime errors or out-of-bound accesses, terminates the Decoder".
- The state page is only an optimisation: the decoder must be correct on its first call, and the runtime may clear the state page.
- A file may carry a "Decoder URI and Decoder cryptographic checksum", and a downloaded decoder "should always be verified against the checksum". A host may also swap in a native implementation by matching the checksum.
- Rejected alternatives: eBPF/uBPF (verifier bugs, limited loops) and container isolation (data-transfer cost).
- I found no explicit fuel or time limit in the paper.
[verified] https://www.vldb.org/pvldb/vol18/p4017-gienieczko.pdf
- ABI:
-
IPLD Wasm codecs / Kubo PR #9016 (2022, draft, unmerged).
- Codecs and ADLs are loaded from a local
WasmPathnamed in the config. The "WAC" calling convention maps the IPLD data model across the boundary (spec proposed as ipld/ipld#226). - Fuel was fixed at
fuelPerOp = 10,000,000. The author noted that inconsistent limits could make data load in one implementation but not another. - A reviewer asked for a deterministic interpreter with no randomness or I/O. Loading by CID would need a 2 MiB size cap.
[verified] https://github.com/ipfs/kubo/pull/9016; https://github.com/ipld/wasm-ipld ("Heavily WIP")
- Codecs and ADLs are loaded from a local
-
The "IPLD autocodec" talk (IPFS þing 2022) proposed content-addressed Wasm blobs that carry their own decoder. [unverified] https://noti.st/expede/CWHgTE
Deterministic, bounded execution of untrusted Wasm
-
The WebAssembly design document lists where the spec allows nondeterminism:
- NaN bit patterns and NaN sign;
- relaxed SIMD;
- shared-memory threads;
- resource exhaustion: "Memory allocation may fail", stack exhaustion, and physical page allocation failing on first touch;
- which features an implementation supports.
[verified] https://github.com/WebAssembly/design/blob/main/Nondeterminism.md
-
The Wasm 3.0 core spec, Appendix "Profiles", defines a deterministic profile: "All NaN values generated by floating-point instructions are canonical and positive"; "All relaxed vector instructions have a fixed behaviour".
memory.growandtable.grow"technically remain non-deterministic" so they can signal resource exhaustion. [verified] https://webassembly.github.io/spec/core/appendix/profiles.html -
Wasmtime
Config::consume_fuel: "can be used to deterministically prevent infinitely-executing WebAssembly code… When fuel runs out a trap is raised."- Fuel use is imprecise when a trap occurs.
- Copy-on-write memory init (
memory_init_cow, on by default) makes instantiation fuel depend on the host. Turn it off for identical fuel on every platform.
[verified] https://github.com/bytecodealliance/wasmtime/blob/main/crates/wasmtime/src/config.rs
-
Wasmtime
epoch_interruptionis up to 2–3x faster than fuel but not deterministic: "Fuel, in contrast, should be used when deterministic yielding or trapping is needed." Bulk-memory operations check the epoch only once, so time-sensitive hosts should bound heap size with aResourceLimiter. [verified] (same file) -
Wasmtime
cranelift_nan_canonicalization(default off) is "useful for users requiring entirely deterministic WebAssembly computation".relaxed_simd_deterministic(default off) forces the same relaxed-SIMD results on every architecture. [verified] (same file) -
Browsers have no fuel API in the WebAssembly JS API. [unverified] The tools they do have:
WebAssembly.Memory({maximum}), which is "a hint to the engine… the engine may ignore or clamp this reservation request", and allocation failure throwsRangeError. [verified] https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/JavaScript_interface/Memory/MemoryWorker.terminate(), which "immediately terminates the Worker… it is stopped at once". [verified] https://developer.mozilla.org/en-US/docs/Web/API/Worker/terminate- Analysis: deterministic step limits in a browser need instruction-count instrumentation inside the module, or a Wasm interpreter compiled to Wasm.
Analysis for the codec design:
- Require the deterministic profile and no imports, or only a fixed, pure host ABI.
- Fix a maximum memory size (pages) and a fuel budget in the codec specification itself, not per implementation.
- Mandate NaN canonicalisation, or forbid floating point.
- Identify codecs by hash. Neither F3 nor AnyBlox solved trust beyond a checksum; a registry of signed codec hashes would be new work.
5. Verifying a small credential by hash lookup instead of an embedded signature
Bottom line. The closest prior art is the W3C "Verifiable Credential Forgery Defense v1.0" Working Draft (25 Aug 2026). An issuer publishes a signed, static, CDN-cacheable witness list. Each entry is the first b bits (default 128, minimum 32) of SHA-256(public seed ‖ credentialHash), and the verifier recomputes the witness at the credential's index. It is indexed by position, not by hash-prefix buckets, and it targets stolen or quantum-broken signing keys. The other systems listed below each match part of the design: EU DCC revocation (hash prefixes partitioned by key ID), CT and CRLite (complete issuance sets), and HIBP and Safe Browsing (k-anonymous prefix queries). Known pitfalls:
- A public seed or bare hash lets anyone test guessed credentials offline, so low-entropy content needs a secret or high-entropy salt in the credential.
- Hash-prefix buckets leak enough to speed up targeted guessing (12x in a CCS 2019 study).
- Small lists or per-holder lists allow tracking, so W3C and IETF set a minimum of 131,072 entries.
- Freshness, rollback and issuer repudiation need TTLs, signatures and archived lists.
NIST IR 8547 (final, Oct 2026) says all approved symmetric primitives with at least 128-bit classical security meet at least PQC Category 1. SHA-256 is Category 2 for collisions and 5 for preimages. Truncation lowers this to λ/2 bits of collision resistance and λ bits of preimage resistance (SP 800-107r1). HMAC tags must be at least 32 bits, and anything under 64 bits needs risk analysis (SP 800-224 ipd).
Hash-anchored or issuance-list schemes
-
W3C VC Forgery Defense v1.0 (WD, 2026-08-25):
- Witness = first b bits of SHA-256(UTF-8(seed) ‖ credentialHash); b defaults to 128 (at least 32, at least 128 recommended).
- The seed is public, has at least 122 bits of min-entropy, and is regenerated on every revision.
- The list is a signed
WitnessListCredential, ideally signed with a separate key, and post-quantum signatures are allowed. It is static per revision, served via CDN or content addressing, and verifiers cache it for its validity period. witnessCountmust be at least 131,072, with every slot filled (placeholders where unused). Witnesses are regenerated on each update.- Limits the spec itself notes: the issuer can repudiate by dropping a witness, so relying parties should archive lists and transparency logs help; and anyone with the list can test candidate credentials offline.
- The spec does not define how
credentialHashis derived.
[verified] https://www.w3.org/TR/vc-forgery-defense-1.0/
-
Certificate Transparency v2 (RFC 9162): "publicly logging the existence of TLS server certificates as they are issued… eventually clients would refuse to honor certificates that do not appear in a log". [verified] https://www.rfc-editor.org/rfc/rfc9162.txt
-
CRLite (Mozilla):
- Cascading Bloom filters over the complete certificate set taken from CT plus scans. "using Certificate Transparency as an oracle, the whole Web PKI's certificate corpus is verified through the filter"; the filter is valid only for certificates known to the generator.
- About 300 MB of revocation data becomes about 1 MB (a 1.3 MB compressed filter in Part 2), updated four times a day.
- Delta files were not yet shipped in 2020.
[verified] https://blog.mozilla.org/security/2020/01/09/crlite-part-1-all-web-pki-revocations-compressed/, https://blog.mozilla.org/security/2020/01/09/crlite-part-2-end-to-end-design/
-
EU DCC revocation, a vaccine-credential system that verifies by hash:
- The reference distribution service offers
BLOOMFILTERandVARHASHLISTformats, with a configurableprobRateandminByteCount(the minimum number of hash bytes). - Routes:
lists/{kid}/partitions/{id}/chunks/{cid}/slices. - Each revoked hash is bucketed by the first one, two or three hex characters (
x = hexHash.charAt(0),y = charAt(1),z = charAt(2)). Size thresholds choose the scheme: point ≤100,000 entries, vector ≤1,600,000, coordinate above that.
This is prefix bucketing of hashes, in production, for health credentials, though it is a deny-list, not an issuance list. [verified] https://github.com/eu-digital-green-certificates/dgca-revocation-distribution-service (README,
src/main/resources/db/changelog/*.sql,RevocationListService.java)- Hash types are SIGNATURE (SHA-256 of the ECDSA
rvalue), UCI and COUNTRYCODEUCI, and "just the first 128 bits of the hashes" go into batches. [unverified] (search snippet of the EU revocation specification, document not opened) - The implementing decision says Member States should pseudonymise certificate attributes "by means of an irreversible hash". [unverified] (search snippet, https://eur-lex.europa.eu/eli/dec_impl/2021/1073/oj)
- The reference distribution service offers
-
W3C Bitstring Status List v1.0:
- Minimum length 131,072 entries (16 KB uncompressed) "for an adequate amount of group privacy".
- Indexes SHOULD be assigned randomly. Verifiers SHOULD cache, and
ttlgives the refresh time. - Risks the spec names: the publisher can "correlate the holder, time, and verifier"; a malicious issuer could use one list per credential for one-to-one tracking. CDNs are suggested as mitigation.
[verified] https://www.w3.org/TR/vc-bitstring-status-list/
-
IETF Token Status List (draft-ietf-oauth-status-list-21):
- In the RFC Editor queue ("Final Approval Pending"); covers JWT, SD-JWT, CWT and ISO mdoc.
- Herd privacy grows with list size;
ttlcontrols refresh. - It warns that relying parties may store uri+index and build a profile of a token over repeated checks.
[verified] https://datatracker.ietf.org/doc/draft-ietf-oauth-status-list/
-
PathCheck Verifiable QR has a HASH type (52 Base32 characters) used to chain QRs, not to look them up. [verified] (URL in Section 2)
-
mDL (ISO 18013-5) uses per-element digests inside a signed MSO, which is not lookup-based. [unverified] (from memory)
k-anonymous prefix queries
-
HIBP Pwned Passwords range API:
- Send the first 5 hex characters of a SHA-1 or NTLM hash; the response lists all matching suffixes with counts, "typically… approximately 800".
- The
Add-Padding: trueheader pads every response to 800–1,000 entries; padding entries have count 0.
[verified] https://haveibeenpwned.com/API/v3
-
Google Safe Browsing:
- v4 local database: "The vast majority of hash prefixes are 4 bytes long but some… any length between 4 and 32 bytes", using SHA-256 prefixes. [verified] https://developers.google.com/safe-browsing/v4/local-databases
- v5
hashes.search: "Only a 4-byte hash prefix of the URL hashed is in the request", optionally sent over Oblivious HTTP to hide the client's IP. [verified] https://developers.google.com/safe-browsing/reference
-
Li, Pal, Ali, Sullivan, Chatterjee, Ristenpart, "Protocols for Checking Compromised Credentials" (CCS 2019): "in some contexts knowing the hash prefixes leads to a 12x increase in the efficacy of remote guessing attacks." [verified] https://arxiv.org/abs/1905.13737
NIST on post-quantum strength of hashes and MACs
-
NIST IR 8547 (final, Oct 2026), §4.1.3: "all NIST-approved symmetric primitives that provide at least 128 bits of classical security are believed to meet the requirements of at least Category 1 security… NIST has a few symmetric cryptography standards at the 112-bit security level, which will be disallowed in 2030." §2.1.3: "NIST does not expect to need to transition away from these standards as part of the PQC migration." [verified] https://nvlpubs.nist.gov/nistpubs/ir/2026/NIST.IR.8547.pdf
-
NIST IR 8547 Table 1 defines Category 2 as "Collision search on a 256-bit hash function (SHA-256)". Table 8: SHA-256 has 128-bit classical collision strength (Category 2) and 256-bit preimage strength (Category 5). SHAKE128 is 128/128 (Category 2). [verified] (same PDF)
-
SP 800-107r1 §5.1 (truncated digests):
- Take the λ left-most bits; "If collision resistance is required, λ shall be at least twice the required collision resistance strength s".
- "the expected collision resistance strength is reduced from L/2 to λ/2"; "The truncated message digest of λ bits provides an expected preimage resistance of λ bits".
- It warns about confusion over the truncation length and the hash used.
[verified] https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-107r1.pdf
-
SP 800-224 ipd (HMAC):
- R7: "the length of the truncated HMAC output shall be at least 32 bits, and shall remain constant across the life-span of the key. Any tag output length that is less than 64 bits should only be selected after careful risk analysis".
- R8: applications using truncated tags "shall determine a maximum number of failed tag verifications" and retire the key after that many.
[verified] https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-224.ipd.pdf
Analysis:
- A 128-bit truncated SHA-256 used only as a lookup key needs second-preimage resistance (λ = 128 bits), not collision resistance, unless the issuer could be malicious and benefit from two credentials sharing a hash. On that reading it sits at or above NIST's 128-bit line.
- Grover's algorithm in principle halves preimage work. IR 8547 nonetheless places 128-bit-classical primitives in Category 1.
- If the issuer must be held to collision resistance, λ must be 256.
Pitfalls to design against
- Guessing. Hashes of low-entropy content (name, DOB, vaccine, date) can be enumerated. Put at least 128 bits of random salt or nonce in the credential, or use a keyed construction. The W3C forgery-defense spec makes its seed public, so it relies on the credential hash already carrying entropy.
- Bucket leakage. Prefix queries reveal the bucket; with a known candidate set, k-anonymity can collapse (Li et al. 2019). Fix a bucket size, pad buckets to a constant size (as HIBP's
Add-Paddingdoes), and prefer downloading whole static files over per-query endpoints. - Tracking. Per-holder or small lists allow correlation. Bitstring Status List, Token Status List and Forgery Defense all set or argue for a floor of 131,072 entries and CDN caching.
- Freshness, rollback and repudiation. Lists need signatures, validity periods or TTLs, and archiving. CRLite and DCC update several times a day; CRLite delayed shipping deltas.
Open questions I could not resolve
- Does
VNBarcodeObservation.payloadData(iOS 17+) return the decoded segment bytes or the raw codeword stream, and does ML KitgetRawBytes()include the mode and length headers? Only a device test with a known byte-mode symbol can settle this. - What do Chrome's
BarcodeDetector(Android: Play Services; macOS: Vision) and Safari return inrawValuefor non-UTF-8 byte-mode data: replacement characters, Latin-1, or an empty string? I found no documentation or bug report. - Are there length limits or truncation in the Android camera apps (Pixel camera, Google Lens, Samsung camera) for a custom-scheme URI followed by about 2,400 digits? No reports found either way.
- Does the printed Aadhaar Secure QR use numeric mode, at which version and ECC level, and is the compression gzip as community decoders assume? The UIDAI spec does not say, and the original PDF is gone from uidai.gov.in. The archived copy is cited above.
- The official ANTS 2D-Doc specification and the EU DCC revocation specification (hash truncation to 128 bits) were not opened; those details are from secondary sources or snippets.
- I found no controlled study of modern-phone decode rate against QR version at a fixed physical size (for example V22 compared with V25–V30 at 40 mm), on paper or on screen.
- I found no deployed system that uses fixed-size block decimal conversion (for example 7 bytes → 17 digits). Aadhaar (one big integer) and SHC (6 bits → 2 digits) are the deployed points; SeedQR (11 bits → 4 digits) is a non-credential example.
- There is no standard or registry for content-addressed Wasm codecs with a fixed fuel and memory budget. Kubo PR #9016 raised this and left it unresolved.