FAILURE MAP
← Case archive

FA-71961 / Error-correcting codes / Open access

GF(256) multiply accumulates with integer addition · case 01

Products exceed 255 or differ from the field product.

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

ROOT CAUSE

Partial products are combined with + instead of XOR (field addition).

VERIFIED REPAIR

Accumulate with XOR.

Unsuccessful approach: Combining with OR loses cancellation of equal bits.

Case contract

Multiply two elements of GF(2^8) defined by the primitive polynomial x^8+x^4+x^3+x^2+1 (0x11D) using shift-and-add. Operands outside 0..255 return None.

Why this case matters

Reed-Solomon codecs for storage and QR codes are built on GF(2^8) arithmetic with polynomial 0x11D.

1 / The failure

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

N = 1
observations = []
def solve(a, b):
    if not (0 <= a < 256 and 0 <= b < 256):
        return None
    p = 0
    for _ in range(8):
        if b & 1:
            p += a
        b >>= 1
        carry = a & 0x80
        a = (a << 1) & 0xFF
        if carry:
            a ^= 0x1D
    return p
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [158, 185]', [158, 185], 141], ['regression [66, 7]', [66, 7], 211], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None]], [['regression [198, 115]', [198, 115], 153], ['regression [136, 144]', [136, 144], 15], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29]], [['regression [243, 34]', [243, 34], 240], ['regression [9, 184]', [9, 184], 17], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29]], [['regression [44, 122]', [44, 122], 249], ['regression [232, 214]', [232, 214], 217], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200]], [['regression [231, 130]', [231, 130], 45], ['regression [28, 61]', [28, 61], 246], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0]]]
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 fixtureActualExpectedOutcome
regression [158, 185]521141Failed
regression [66, 7]219211Failed
control [2, 96]192192Passed
control [0, 5]00Passed
control [1, 200]200200Passed
control [2, 128]2929Passed
control [128, 2]2929Passed
control [256, 1]NoneNonePassed

SHA-256 / 80c09e2bca313ab2d12bf60f9388f11fe4a0d94230a6a34b29e591da74cd0117

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(a, b):
    if not (0 <= a < 256 and 0 <= b < 256):
        return None
    p = 0
    for _ in range(8):
        if b & 1:
            p |= a
        b >>= 1
        carry = a & 0x80
        a = (a << 1) & 0xFF
        if carry:
            a ^= 0x1D
    return p
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [158, 185]', [158, 185], 141], ['regression [66, 7]', [66, 7], 211], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None]], [['regression [198, 115]', [198, 115], 153], ['regression [136, 144]', [136, 144], 15], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29]], [['regression [243, 34]', [243, 34], 240], ['regression [9, 184]', [9, 184], 17], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29]], [['regression [44, 122]', [44, 122], 249], ['regression [232, 214]', [232, 214], 217], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200]], [['regression [231, 130]', [231, 130], 45], ['regression [28, 61]', [28, 61], 246], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0]]]
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 fixtureActualExpectedOutcome
regression [158, 185]191141Failed
regression [66, 7]215211Failed
control [2, 96]192192Passed
control [0, 5]00Passed
control [1, 200]200200Passed
control [2, 128]2929Passed
control [128, 2]2929Passed
control [256, 1]NoneNonePassed

SHA-256 / d61454f80cc373f4752941757d8dc455ad60d148d994af1e27e82a9fa34b0a6f

3 / The verified repair

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

N = 1
observations = []
def solve(a, b):
    if not (0 <= a < 256 and 0 <= b < 256):
        return None
    p = 0
    for _ in range(8):
        if b & 1:
            p ^= a
        b >>= 1
        carry = a & 0x80
        a = (a << 1) & 0xFF
        if carry:
            a ^= 0x1D
    return p
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [158, 185]', [158, 185], 141], ['regression [66, 7]', [66, 7], 211], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None]], [['regression [198, 115]', [198, 115], 153], ['regression [136, 144]', [136, 144], 15], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29]], [['regression [243, 34]', [243, 34], 240], ['regression [9, 184]', [9, 184], 17], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29]], [['regression [44, 122]', [44, 122], 249], ['regression [232, 214]', [232, 214], 217], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0], ['control [1, 200]', [1, 200], 200]], [['regression [231, 130]', [231, 130], 45], ['regression [28, 61]', [28, 61], 246], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29], ['control [256, 1]', [256, 1], None], ['control [2, 96]', [2, 96], 192], ['control [0, 5]', [0, 5], 0]]]
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 fixtureActualExpectedOutcome
regression [158, 185]141141Passed
regression [66, 7]211211Passed
control [2, 96]192192Passed
control [0, 5]00Passed
control [1, 200]200200Passed
control [2, 128]2929Passed
control [128, 2]2929Passed
control [256, 1]NoneNonePassed

SHA-256 / d9e0d3e15cfe93f466fa9bcf2c529e8b9cc34b531141348b33f4bfba45be21c5

Verification & scope

A deterministic, bounded teaching model of the named code under the stated contract; not a production codec. 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:34.191611+00:00.

Case digest / 43d6bb3f539f10279c027c1c1a71ca6362320bbb779e850cd99f49626cdb8c1e