FA-72646 / Check-digit algorithms / Open access
Code 128 set B rejects DEL · case 01
Data containing DEL (value 95) in set B is refused.
ROOT CAUSE
The set B range stops at 126.
VERIFIED REPAIR
Set B covers code points 32 through 127 inclusive.
Unsuccessful approach: Requiring printable characters also excludes DEL.
Case contract
Code 128 symbol check value. Start codes A/B/C have values 103/104/105 (other codes: None). Code B accepts characters 32..127 (value ord - 32); code A accepts 0..95 (values ord - 32, controls ord + 64); code C accepts an even number of ASCII digits taken in pairs (value 0..99). The checksum is (start + sum(position * value)) mod 103 with positions starting at 1 after the start code. Invalid data returns None.
Why this case matters
Label printers compute the Code 128 check symbol before rendering shipping barcodes.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(code, data):
starts = {'A': 103, 'B': 104, 'C': 105}
if code not in starts:
return None
if code == 'C':
if len(data) % 2 or not data.isascii() or not data.isdigit():
return None
values = [int(data[i:i + 2]) for i in range(0, len(data), 2)]
elif code == 'B':
if any(not 32 <= ord(ch) <= 126 for ch in data):
return None
values = [ord(ch) - 32 for ch in data]
else:
if any(not 0 <= ord(ch) <= 95 for ch in data):
return None
values = [ord(ch) - 32 if ord(ch) >= 32 else ord(ch) + 64 for ch in data]
total = starts[code]
for pos, v in enumerate(values, 1):
total += pos * v
return total % 103
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['control ["B", "@w~\'"]', ['B', "@w~'"], 2], ['control ["B", "Ht?"]', ['B', 'Ht?'], 96], ['control ["B", "U?tS;F"]', ['B', 'U?tS;F'], 8], ['control ["B", ")r"]', ['B', ')r'], 71], ['control ["B", "YyUx>VrW{?"]', ['B', 'YyUx>VrW{?'], 68], ['control ["B", "4Y&P%jOM+J/"]', ['B', '4Y&P%jOM+J/'], 24]], [['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['control ["B", "4Y&P%jOM+J/"]', ['B', '4Y&P%jOM+J/'], 24], ['control ["B", "wm$|^uemYo/"]', ['B', 'wm$|^uemYo/'], 95], ['control ["B", "UI}*7pnZebjZ"]', ['B', 'UI}*7pnZebjZ'], 10], ['control ["B", "GOJ%^JsFlN="]', ['B', 'GOJ%^JsFlN='], 100], ['control ["B", "{j]OWCR"]', ['B', '{j]OWCR'], 4], ['control ["C", "9158"]', ['C', '9158'], 3]], [['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['control ["C", "9158"]', ['C', '9158'], 3], ['control ["C", "32273629"]', ['C', '32273629'], 3], ['control ["C", "976797"]', ['C', '976797'], 9], ['control ["C", "209091"]', ['C', '209091'], 63], ['control ["C", "5357244392"]', ['C', '5357244392'], 49], ['control ["C", "68"]', ['C', '68'], 70]], [['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['control ["C", "68"]', ['C', '68'], 70], ['control ["A", "0%!J\\u0011"]', ['A', '0%!J\x11'], 87], ['control ["A", "\\u0005\\u00000_;V"]', ['A', '\x05\x000_;V'], 29], ['control ["A", "\\u0005\\u0017F"]', ['A', '\x05\x17F'], 48], ['control ["A", ",B\\u001e\\u000e_#Y"]', ['A', ',B\x1e\x0e_#Y'], 67], ['control ["A", "\\u0010\\u0015>D\\u0001\\u0013"]', ['A', '\x10\x15>D\x01\x13'], 71]], [['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['control ["A", "\\u0010\\u0015>D\\u0001\\u0013"]', ['A', '\x10\x15>D\x01\x13'], 71], ['control ["A", "H\\u0010\\u001c7F"]', ['A', 'H\x10\x1c7F'], 37], ['control ["B", "PJJ123C"]', ['B', 'PJJ123C'], 55], ['control ["B", "Wikipedia"]', ['B', 'Wikipedia'], 88], ['control ["C", "123456"]', ['C', '123456'], 44], ['control ["C", "12345"]', ['C', '12345'], None]]]
for label, args, expected in fixtures[N - 1]:
check(label, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression ["B", "a"] | None | 50 | Failed |
| regression ["B", ""] | None | 96 | Failed |
| control ["B", "@w~'"] | 2 | 2 | Passed |
| control ["B", "Ht?"] | 96 | 96 | Passed |
| control ["B", "U?tS;F"] | 8 | 8 | Passed |
| control ["B", ")r"] | 71 | 71 | Passed |
| control ["B", "YyUx>VrW{?"] | 68 | 68 | Passed |
| control ["B", "4Y&P%jOM+J/"] | 24 | 24 | Passed |
SHA-256 / 86c2d0b7209b63b8aeaf39eba02704feb9e7c8cb29659c9f5d780aea3625a3f9
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(code, data):
starts = {'A': 103, 'B': 104, 'C': 105}
if code not in starts:
return None
if code == 'C':
if len(data) % 2 or not data.isascii() or not data.isdigit():
return None
values = [int(data[i:i + 2]) for i in range(0, len(data), 2)]
elif code == 'B':
if any(not (32 <= ord(ch) <= 127 and ch.isprintable()) for ch in data):
return None
values = [ord(ch) - 32 for ch in data]
else:
if any(not 0 <= ord(ch) <= 95 for ch in data):
return None
values = [ord(ch) - 32 if ord(ch) >= 32 else ord(ch) + 64 for ch in data]
total = starts[code]
for pos, v in enumerate(values, 1):
total += pos * v
return total % 103
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['control ["B", "@w~\'"]', ['B', "@w~'"], 2], ['control ["B", "Ht?"]', ['B', 'Ht?'], 96], ['control ["B", "U?tS;F"]', ['B', 'U?tS;F'], 8], ['control ["B", ")r"]', ['B', ')r'], 71], ['control ["B", "YyUx>VrW{?"]', ['B', 'YyUx>VrW{?'], 68], ['control ["B", "4Y&P%jOM+J/"]', ['B', '4Y&P%jOM+J/'], 24]], [['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['control ["B", "4Y&P%jOM+J/"]', ['B', '4Y&P%jOM+J/'], 24], ['control ["B", "wm$|^uemYo/"]', ['B', 'wm$|^uemYo/'], 95], ['control ["B", "UI}*7pnZebjZ"]', ['B', 'UI}*7pnZebjZ'], 10], ['control ["B", "GOJ%^JsFlN="]', ['B', 'GOJ%^JsFlN='], 100], ['control ["B", "{j]OWCR"]', ['B', '{j]OWCR'], 4], ['control ["C", "9158"]', ['C', '9158'], 3]], [['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['control ["C", "9158"]', ['C', '9158'], 3], ['control ["C", "32273629"]', ['C', '32273629'], 3], ['control ["C", "976797"]', ['C', '976797'], 9], ['control ["C", "209091"]', ['C', '209091'], 63], ['control ["C", "5357244392"]', ['C', '5357244392'], 49], ['control ["C", "68"]', ['C', '68'], 70]], [['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['control ["C", "68"]', ['C', '68'], 70], ['control ["A", "0%!J\\u0011"]', ['A', '0%!J\x11'], 87], ['control ["A", "\\u0005\\u00000_;V"]', ['A', '\x05\x000_;V'], 29], ['control ["A", "\\u0005\\u0017F"]', ['A', '\x05\x17F'], 48], ['control ["A", ",B\\u001e\\u000e_#Y"]', ['A', ',B\x1e\x0e_#Y'], 67], ['control ["A", "\\u0010\\u0015>D\\u0001\\u0013"]', ['A', '\x10\x15>D\x01\x13'], 71]], [['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['control ["A", "\\u0010\\u0015>D\\u0001\\u0013"]', ['A', '\x10\x15>D\x01\x13'], 71], ['control ["A", "H\\u0010\\u001c7F"]', ['A', 'H\x10\x1c7F'], 37], ['control ["B", "PJJ123C"]', ['B', 'PJJ123C'], 55], ['control ["B", "Wikipedia"]', ['B', 'Wikipedia'], 88], ['control ["C", "123456"]', ['C', '123456'], 44], ['control ["C", "12345"]', ['C', '12345'], None]]]
for label, args, expected in fixtures[N - 1]:
check(label, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression ["B", "a"] | None | 50 | Failed |
| regression ["B", ""] | None | 96 | Failed |
| control ["B", "@w~'"] | 2 | 2 | Passed |
| control ["B", "Ht?"] | 96 | 96 | Passed |
| control ["B", "U?tS;F"] | 8 | 8 | Passed |
| control ["B", ")r"] | 71 | 71 | Passed |
| control ["B", "YyUx>VrW{?"] | 68 | 68 | Passed |
| control ["B", "4Y&P%jOM+J/"] | 24 | 24 | Passed |
SHA-256 / 8701c0f7b1572dd9354d029bf67843f0bf811b28e470e71bffb34cb7cacc1fad
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(code, data):
starts = {'A': 103, 'B': 104, 'C': 105}
if code not in starts:
return None
if code == 'C':
if len(data) % 2 or not data.isascii() or not data.isdigit():
return None
values = [int(data[i:i + 2]) for i in range(0, len(data), 2)]
elif code == 'B':
if any(not 32 <= ord(ch) <= 127 for ch in data):
return None
values = [ord(ch) - 32 for ch in data]
else:
if any(not 0 <= ord(ch) <= 95 for ch in data):
return None
values = [ord(ch) - 32 if ord(ch) >= 32 else ord(ch) + 64 for ch in data]
total = starts[code]
for pos, v in enumerate(values, 1):
total += pos * v
return total % 103
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['control ["B", "@w~\'"]', ['B', "@w~'"], 2], ['control ["B", "Ht?"]', ['B', 'Ht?'], 96], ['control ["B", "U?tS;F"]', ['B', 'U?tS;F'], 8], ['control ["B", ")r"]', ['B', ')r'], 71], ['control ["B", "YyUx>VrW{?"]', ['B', 'YyUx>VrW{?'], 68], ['control ["B", "4Y&P%jOM+J/"]', ['B', '4Y&P%jOM+J/'], 24]], [['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['control ["B", "4Y&P%jOM+J/"]', ['B', '4Y&P%jOM+J/'], 24], ['control ["B", "wm$|^uemYo/"]', ['B', 'wm$|^uemYo/'], 95], ['control ["B", "UI}*7pnZebjZ"]', ['B', 'UI}*7pnZebjZ'], 10], ['control ["B", "GOJ%^JsFlN="]', ['B', 'GOJ%^JsFlN='], 100], ['control ["B", "{j]OWCR"]', ['B', '{j]OWCR'], 4], ['control ["C", "9158"]', ['C', '9158'], 3]], [['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['control ["C", "9158"]', ['C', '9158'], 3], ['control ["C", "32273629"]', ['C', '32273629'], 3], ['control ["C", "976797"]', ['C', '976797'], 9], ['control ["C", "209091"]', ['C', '209091'], 63], ['control ["C", "5357244392"]', ['C', '5357244392'], 49], ['control ["C", "68"]', ['C', '68'], 70]], [['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['control ["C", "68"]', ['C', '68'], 70], ['control ["A", "0%!J\\u0011"]', ['A', '0%!J\x11'], 87], ['control ["A", "\\u0005\\u00000_;V"]', ['A', '\x05\x000_;V'], 29], ['control ["A", "\\u0005\\u0017F"]', ['A', '\x05\x17F'], 48], ['control ["A", ",B\\u001e\\u000e_#Y"]', ['A', ',B\x1e\x0e_#Y'], 67], ['control ["A", "\\u0010\\u0015>D\\u0001\\u0013"]', ['A', '\x10\x15>D\x01\x13'], 71]], [['regression ["B", "a\x7f"]', ['B', 'a\x7f'], 50], ['regression ["B", "\x7f"]', ['B', '\x7f'], 96], ['control ["A", "\\u0010\\u0015>D\\u0001\\u0013"]', ['A', '\x10\x15>D\x01\x13'], 71], ['control ["A", "H\\u0010\\u001c7F"]', ['A', 'H\x10\x1c7F'], 37], ['control ["B", "PJJ123C"]', ['B', 'PJJ123C'], 55], ['control ["B", "Wikipedia"]', ['B', 'Wikipedia'], 88], ['control ["C", "123456"]', ['C', '123456'], 44], ['control ["C", "12345"]', ['C', '12345'], None]]]
for label, args, expected in fixtures[N - 1]:
check(label, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression ["B", "a"] | 50 | 50 | Passed |
| regression ["B", ""] | 96 | 96 | Passed |
| control ["B", "@w~'"] | 2 | 2 | Passed |
| control ["B", "Ht?"] | 96 | 96 | Passed |
| control ["B", "U?tS;F"] | 8 | 8 | Passed |
| control ["B", ")r"] | 71 | 71 | Passed |
| control ["B", "YyUx>VrW{?"] | 68 | 68 | Passed |
| control ["B", "4Y&P%jOM+J/"] | 24 | 24 | Passed |
SHA-256 / 2cb79c8f9d07efa5bb10e9f928be1de5dd97e5e3c4d91aeac3abf3c482d1930f
Verification & scope
A deterministic, bounded teaching model of the named scheme under the stated contract; not a certified validator. 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:48:40.349186+00:00.
Case digest / a04bbab62873cd97c6b8653eb3f5cba376043b250c379ee51f7d7d6cee4c41a5