FAILURE MAP
← Case archive

FA-79671 / Barcode symbology encoding / Open access

QR alphanumeric pairs weight the second character · case 01

Scanned text has every pair of characters swapped, so "AC" reads as "CA".

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The multiplier 45 is applied to the second character of the pair.

VERIFIED REPAIR

Multiply the first character's value by 45 and add the second.

Unsuccessful approach: A base of 44 makes distinct pairs collide.

Case contract

Encode the data part of a QR alphanumeric segment. Character values: 0-9 -> 0-9, A-Z -> 10-35, space 36, $ 37, % 38, * 39, + 40, - 41, . 42, / 43, : 44. Each pair becomes 45*first + second in 11 bits, a final single character becomes its value in 6 bits. Characters outside the set return None.

Why this case matters

Retail, logistics, pharmacy and document workflows depend on encoders that produce exactly the module pattern, code-set switches, separators and quiet zones scanners expect; one misplaced module or separator makes a label unreadable or, worse, scan as different data.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'
    if any(c not in ALNUM for c in s):
        return None
    bits = ''
    for i in range(0, len(s) - 1, 2):
        v = ALNUM.index(s[i]) + 45 * ALNUM.index(s[i + 1])
        bits += format(v, '011b')
    if len(s) % 2:
        bits += format(ALNUM.index(s[-1]), '06b')
    return bits
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['IG:', '01100111010101100'], ['R1K', '10011000000010100'], ['', ''], ['X', '100001'], ['4', '000100'], ['L', '010101'], ['2', '000010'], ['A8CG', '0011100101001000101100']], [[':HKK4', '1111100110101110011000000100'], ['0-KJ', '0000010100101110010111'], ['E', '001110'], ['', ''], ['S', '011100'], ['-', '101001'], [':', '101100'], ['Z6UKSE', '110001011011010101101010011111010']], [['Y6WB', '1100000000010110101011'], ['EAB AB', '010100000000100001001100111001101'], ['X', '100001'], ['', ''], ['Q', '011010'], ['9', '001001'], ['2', '000010'], ['T:XJ6', '1010100010110111100000000110']], [['P.9 MW9', '100100011110011011100101111111110001001'], ['M12BT%B', '011110111110000110010110100111111001011'], ['', ''], [' ', '100100'], ['F', '001111'], ['M', '010110'], ['*', '100111'], ['HE9', '01100001011001001']], [['RBW3-', '1001100101010110100011101001'], ['EG$9', '0101000011011010001010'], ['', ''], ['P', '011001'], ['H', '010001'], ['D', '001101'], ['M', '010110'], ['TY9', '10100111011001001']]]
labels = ["regression: pair value weighting", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: pair value weighting 00101110001010110001100111010101100Failed
repair trap 10000100100001010010011000000010100Failed
combined fault 2Passed
control 3100001100001Passed
control 4000100000100Passed
boundary 5010101010101Passed
boundary 6000010000010Passed
control 700101110010010110111000011100101001000101100Failed

SHA-256 / 2d1758b488eddf964e9782d54f3ae37f59127ded252a88f79a15b3625d45a670

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'
    if any(c not in ALNUM for c in s):
        return None
    bits = ''
    for i in range(0, len(s) - 1, 2):
        v = 44 * ALNUM.index(s[i]) + ALNUM.index(s[i + 1])
        bits += format(v, '011b')
    if len(s) % 2:
        bits += format(ALNUM.index(s[-1]), '06b')
    return bits
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['IG:', '01100111010101100'], ['R1K', '10011000000010100'], ['', ''], ['X', '100001'], ['4', '000100'], ['L', '010101'], ['2', '000010'], ['A8CG', '0011100101001000101100']], [[':HKK4', '1111100110101110011000000100'], ['0-KJ', '0000010100101110010111'], ['E', '001110'], ['', ''], ['S', '011100'], ['-', '101001'], [':', '101100'], ['Z6UKSE', '110001011011010101101010011111010']], [['Y6WB', '1100000000010110101011'], ['EAB AB', '010100000000100001001100111001101'], ['X', '100001'], ['', ''], ['Q', '011010'], ['9', '001001'], ['2', '000010'], ['T:XJ6', '1010100010110111100000000110']], [['P.9 MW9', '100100011110011011100101111111110001001'], ['M12BT%B', '011110111110000110010110100111111001011'], ['', ''], [' ', '100100'], ['F', '001111'], ['M', '010110'], ['*', '100111'], ['HE9', '01100001011001001']], [['RBW3-', '1001100101010110100011101001'], ['EG$9', '0101000011011010001010'], ['', ''], ['P', '011001'], ['H', '010001'], ['D', '001101'], ['M', '010110'], ['TY9', '10100111011001001']]]
labels = ["regression: pair value weighting", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: pair value weighting 00110010100010110001100111010101100Failed
repair trap 11001010010101010010011000000010100Failed
combined fault 2Passed
control 3100001100001Passed
control 4000100000100Passed
boundary 5010101010101Passed
boundary 6000010000010Passed
control 700111000000010001000000011100101001000101100Failed

SHA-256 / b78012f5a00b8bdde915f0536ce04ba49da4b15e9164620e5abdda475573fac0

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'
    if any(c not in ALNUM for c in s):
        return None
    bits = ''
    for i in range(0, len(s) - 1, 2):
        v = 45 * ALNUM.index(s[i]) + ALNUM.index(s[i + 1])
        bits += format(v, '011b')
    if len(s) % 2:
        bits += format(ALNUM.index(s[-1]), '06b')
    return bits
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['IG:', '01100111010101100'], ['R1K', '10011000000010100'], ['', ''], ['X', '100001'], ['4', '000100'], ['L', '010101'], ['2', '000010'], ['A8CG', '0011100101001000101100']], [[':HKK4', '1111100110101110011000000100'], ['0-KJ', '0000010100101110010111'], ['E', '001110'], ['', ''], ['S', '011100'], ['-', '101001'], [':', '101100'], ['Z6UKSE', '110001011011010101101010011111010']], [['Y6WB', '1100000000010110101011'], ['EAB AB', '010100000000100001001100111001101'], ['X', '100001'], ['', ''], ['Q', '011010'], ['9', '001001'], ['2', '000010'], ['T:XJ6', '1010100010110111100000000110']], [['P.9 MW9', '100100011110011011100101111111110001001'], ['M12BT%B', '011110111110000110010110100111111001011'], ['', ''], [' ', '100100'], ['F', '001111'], ['M', '010110'], ['*', '100111'], ['HE9', '01100001011001001']], [['RBW3-', '1001100101010110100011101001'], ['EG$9', '0101000011011010001010'], ['', ''], ['P', '011001'], ['H', '010001'], ['D', '001101'], ['M', '010110'], ['TY9', '10100111011001001']]]
labels = ["regression: pair value weighting", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: pair value weighting 00110011101010110001100111010101100Passed
repair trap 11001100000001010010011000000010100Passed
combined fault 2Passed
control 3100001100001Passed
control 4000100000100Passed
boundary 5010101010101Passed
boundary 6000010000010Passed
control 700111001010010001011000011100101001000101100Passed

SHA-256 / eba005ee0ea85b267f32deb096958f2c1faabf1222151f4e2e8673efb68c4a27

Verification & scope

A deterministic bounded teaching model with a stipulated contract; it makes no claim of conformance to any published specification. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:49:46.685455+00:00.

Case digest / dbe3cd46150170e6263423ea68ee28976b960183c6184d9869d7a4db842b7c37