FA-71966 / Error-correcting codes / Open access
GF(256) multiply tests the carry after shifting · case 01
Operands with the top bit set are not reduced.
ROOT CAUSE
The carry bit is sampled after the shift and mask, when it has already been discarded.
THE FAILURE
The carry bit is sampled after the shift and mask, when it has already been discarded.
Unsuccessful approach: Sampling bit 6 before the shift reduces one step early.
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
a = (a << 1) & 0xFF
carry = a & 0x80
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 [0, 5]', [0, 5], 0], ['control [3, 7]', [3, 7], 9], ['control [256, 1]', [256, 1], None], ['control [198, 115]', [198, 115], 153], ['control [136, 144]', [136, 144], 15], ['control [184, 92]', [184, 92], 29]], [['regression [198, 115]', [198, 115], 153], ['regression [136, 144]', [136, 144], 15], ['control [256, 1]', [256, 1], None], ['control [0, 5]', [0, 5], 0], ['control [3, 7]', [3, 7], 9], ['control [95, 65]', [95, 65], 1], ['control [44, 122]', [44, 122], 249], ['control [232, 214]', [232, 214], 217]], [['regression [243, 34]', [243, 34], 240], ['regression [9, 184]', [9, 184], 17], ['control [3, 7]', [3, 7], 9], ['control [256, 1]', [256, 1], None], ['control [0, 5]', [0, 5], 0], ['control [231, 130]', [231, 130], 45], ['control [28, 61]', [28, 61], 246], ['control [253, 149]', [253, 149], 58]], [['regression [44, 122]', [44, 122], 249], ['regression [232, 214]', [232, 214], 217], ['control [0, 5]', [0, 5], 0], ['control [3, 7]', [3, 7], 9], ['control [256, 1]', [256, 1], None], ['control [117, 177]', [117, 177], 104], ['control [70, 227]', [70, 227], 18], ['control [114, 166]', [114, 166], 104]], [['regression [51, 91]', [51, 91], 155], ['regression [231, 130]', [231, 130], 45], ['control [256, 1]', [256, 1], None], ['control [0, 5]', [0, 5], 0], ['control [3, 7]', [3, 7], 9], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29]]]
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 [158, 185] | 107 | 141 | Failed |
| regression [66, 7] | 233 | 211 | Failed |
| control [0, 5] | 0 | 0 | Passed |
| control [3, 7] | 9 | 9 | Passed |
| control [256, 1] | None | None | Passed |
| control [198, 115] | 188 | 153 | Failed |
| control [136, 144] | 104 | 15 | Failed |
| control [184, 92] | 191 | 29 | Failed |
SHA-256 / 57ecb8ed83a58ea02b25ea965f56cec3d7c5ced08db2cdf124652fcd003fa7a3
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 & 0x40
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 [0, 5]', [0, 5], 0], ['control [3, 7]', [3, 7], 9], ['control [256, 1]', [256, 1], None], ['control [198, 115]', [198, 115], 153], ['control [136, 144]', [136, 144], 15], ['control [184, 92]', [184, 92], 29]], [['regression [198, 115]', [198, 115], 153], ['regression [136, 144]', [136, 144], 15], ['control [256, 1]', [256, 1], None], ['control [0, 5]', [0, 5], 0], ['control [3, 7]', [3, 7], 9], ['control [95, 65]', [95, 65], 1], ['control [44, 122]', [44, 122], 249], ['control [232, 214]', [232, 214], 217]], [['regression [243, 34]', [243, 34], 240], ['regression [9, 184]', [9, 184], 17], ['control [3, 7]', [3, 7], 9], ['control [256, 1]', [256, 1], None], ['control [0, 5]', [0, 5], 0], ['control [231, 130]', [231, 130], 45], ['control [28, 61]', [28, 61], 246], ['control [253, 149]', [253, 149], 58]], [['regression [44, 122]', [44, 122], 249], ['regression [232, 214]', [232, 214], 217], ['control [0, 5]', [0, 5], 0], ['control [3, 7]', [3, 7], 9], ['control [256, 1]', [256, 1], None], ['control [117, 177]', [117, 177], 104], ['control [70, 227]', [70, 227], 18], ['control [114, 166]', [114, 166], 104]], [['regression [51, 91]', [51, 91], 155], ['regression [231, 130]', [231, 130], 45], ['control [256, 1]', [256, 1], None], ['control [0, 5]', [0, 5], 0], ['control [3, 7]', [3, 7], 9], ['control [1, 200]', [1, 200], 200], ['control [2, 128]', [2, 128], 29], ['control [128, 2]', [128, 2], 29]]]
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 [158, 185] | 107 | 141 | Failed |
| regression [66, 7] | 233 | 211 | Failed |
| control [0, 5] | 0 | 0 | Passed |
| control [3, 7] | 9 | 9 | Passed |
| control [256, 1] | None | None | Passed |
| control [198, 115] | 188 | 153 | Failed |
| control [136, 144] | 104 | 15 | Failed |
| control [184, 92] | 191 | 29 | Failed |
SHA-256 / 285673dd2c6c72c69543c19f1a6f885359fcba930f684eaf5423a0392fd41091
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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.267656+00:00.
Case digest / bac7e8177c25c7314cc7affb5c9c7a7dc39dd9a26ba88e5ce1ad5df85dc688da