FA-72591 / Check-digit algorithms / Open access
Resident ID rejects a lowercase x check character · case 01
Identity numbers typed with a lowercase x are rejected.
ROOT CAUSE
The final character is compared case-sensitively.
VERIFIED REPAIR
Compare against s[17].upper().
Unsuccessful approach: Accepting "x" unconditionally lets a lowercase x pass even when the check should be a digit.
Case contract
Check character of an 18-character resident identity number: seventeen ASCII digits followed by a digit or X (lowercase x accepted). Weights are 2^(17-i) mod 11 for 0-based i; the check character is "10X98765432"[sum % 11]. Return [check character, whether the 18th character matches case-insensitively].
Why this case matters
Account opening flows validate national identity numbers before identity verification.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
if len(s) != 18 or not s.isascii() or not s[:17].isdigit():
return 'malformed'
total = sum(int(ch) * pow(2, 17 - i, 11) for i, ch in enumerate(s[:17]))
check = '10X98765432'[total % 11]
return [check, check == s[17]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["268310199103143528"]', ['268310199103143528'], ['9', False]], ['control ["297547197007199229"]', ['297547197007199229'], ['2', False]], ['control ["518849198106269933"]', ['518849198106269933'], ['6', False]], ['control ["405799197903155930"]', ['405799197903155930'], ['7', False]], ['control ["445793197510028320"]', ['445793197510028320'], ['X', False]], ['control ["309071197409120443"]', ['309071197409120443'], ['3', True]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["309071197409120443"]', ['309071197409120443'], ['3', True]], ['control ["594570196107138355"]', ['594570196107138355'], ['2', False]], ['control ["458825200412201114"]', ['458825200412201114'], ['5', False]], ['control ["373498196811139070"]', ['373498196811139070'], ['5', False]], ['control ["18951819720314318X"]', ['18951819720314318X'], ['3', False]], ['control ["600025197711283200"]', ['600025197711283200'], ['5', False]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["600025197711283200"]', ['600025197711283200'], ['5', False]], ['control ["197110195609245785"]', ['197110195609245785'], ['6', False]], ['control ["37858219960314414X"]', ['37858219960314414X'], ['7', False]], ['control ["22100419730209591X"]', ['22100419730209591X'], ['4', False]], ['control ["653847197508233493"]', ['653847197508233493'], ['2', False]], ['control ["438548195709105267"]', ['438548195709105267'], ['4', False]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["438548195709105267"]', ['438548195709105267'], ['4', False]], ['control ["261917197009053555"]', ['261917197009053555'], ['3', False]], ['control ["607248198301138071"]', ['607248198301138071'], ['9', False]], ['control ["148107199504128670"]', ['148107199504128670'], ['3', False]], ['control ["116248195409054166"]', ['116248195409054166'], ['7', False]], ['control ["306465200011013206"]', ['306465200011013206'], ['6', True]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["306465200011013206"]', ['306465200011013206'], ['6', True]], ['control ["11010519491231002X"]', ['11010519491231002X'], ['X', True]], ['control ["110105194912310021"]', ['110105194912310021'], ['X', False]], ['control ["440524188001010014"]', ['440524188001010014'], ['4', True]], ['control ["11010519491231002"]', ['11010519491231002'], 'malformed'], ['control ["1101051949123100XX"]', ['1101051949123100XX'], 'malformed']]]
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 ["11010519491231002x"] | ['X', False] | ['X', True] | Failed |
| partial-repair ["50937819800315206x"] | ['9', False] | ['9', False] | Passed |
| control ["268310199103143528"] | ['9', False] | ['9', False] | Passed |
| control ["297547197007199229"] | ['2', False] | ['2', False] | Passed |
| control ["518849198106269933"] | ['6', False] | ['6', False] | Passed |
| control ["405799197903155930"] | ['7', False] | ['7', False] | Passed |
| control ["445793197510028320"] | ['X', False] | ['X', False] | Passed |
| control ["309071197409120443"] | ['3', True] | ['3', True] | Passed |
SHA-256 / 42da86fc1a529e79a0ebd5a5070470e40b5f0ccad8a6540ba0553518b419c140
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
if len(s) != 18 or not s.isascii() or not s[:17].isdigit():
return 'malformed'
total = sum(int(ch) * pow(2, 17 - i, 11) for i, ch in enumerate(s[:17]))
check = '10X98765432'[total % 11]
return [check, s[17] in (check, 'x')]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["268310199103143528"]', ['268310199103143528'], ['9', False]], ['control ["297547197007199229"]', ['297547197007199229'], ['2', False]], ['control ["518849198106269933"]', ['518849198106269933'], ['6', False]], ['control ["405799197903155930"]', ['405799197903155930'], ['7', False]], ['control ["445793197510028320"]', ['445793197510028320'], ['X', False]], ['control ["309071197409120443"]', ['309071197409120443'], ['3', True]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["309071197409120443"]', ['309071197409120443'], ['3', True]], ['control ["594570196107138355"]', ['594570196107138355'], ['2', False]], ['control ["458825200412201114"]', ['458825200412201114'], ['5', False]], ['control ["373498196811139070"]', ['373498196811139070'], ['5', False]], ['control ["18951819720314318X"]', ['18951819720314318X'], ['3', False]], ['control ["600025197711283200"]', ['600025197711283200'], ['5', False]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["600025197711283200"]', ['600025197711283200'], ['5', False]], ['control ["197110195609245785"]', ['197110195609245785'], ['6', False]], ['control ["37858219960314414X"]', ['37858219960314414X'], ['7', False]], ['control ["22100419730209591X"]', ['22100419730209591X'], ['4', False]], ['control ["653847197508233493"]', ['653847197508233493'], ['2', False]], ['control ["438548195709105267"]', ['438548195709105267'], ['4', False]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["438548195709105267"]', ['438548195709105267'], ['4', False]], ['control ["261917197009053555"]', ['261917197009053555'], ['3', False]], ['control ["607248198301138071"]', ['607248198301138071'], ['9', False]], ['control ["148107199504128670"]', ['148107199504128670'], ['3', False]], ['control ["116248195409054166"]', ['116248195409054166'], ['7', False]], ['control ["306465200011013206"]', ['306465200011013206'], ['6', True]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["306465200011013206"]', ['306465200011013206'], ['6', True]], ['control ["11010519491231002X"]', ['11010519491231002X'], ['X', True]], ['control ["110105194912310021"]', ['110105194912310021'], ['X', False]], ['control ["440524188001010014"]', ['440524188001010014'], ['4', True]], ['control ["11010519491231002"]', ['11010519491231002'], 'malformed'], ['control ["1101051949123100XX"]', ['1101051949123100XX'], 'malformed']]]
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 ["11010519491231002x"] | ['X', True] | ['X', True] | Passed |
| partial-repair ["50937819800315206x"] | ['9', True] | ['9', False] | Failed |
| control ["268310199103143528"] | ['9', False] | ['9', False] | Passed |
| control ["297547197007199229"] | ['2', False] | ['2', False] | Passed |
| control ["518849198106269933"] | ['6', False] | ['6', False] | Passed |
| control ["405799197903155930"] | ['7', False] | ['7', False] | Passed |
| control ["445793197510028320"] | ['X', False] | ['X', False] | Passed |
| control ["309071197409120443"] | ['3', True] | ['3', True] | Passed |
SHA-256 / 07fe8ee079a0fe0c875c4891076ad261005498a7e9fbbd4746d5218e07d61737
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
if len(s) != 18 or not s.isascii() or not s[:17].isdigit():
return 'malformed'
total = sum(int(ch) * pow(2, 17 - i, 11) for i, ch in enumerate(s[:17]))
check = '10X98765432'[total % 11]
return [check, check == s[17].upper()]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["268310199103143528"]', ['268310199103143528'], ['9', False]], ['control ["297547197007199229"]', ['297547197007199229'], ['2', False]], ['control ["518849198106269933"]', ['518849198106269933'], ['6', False]], ['control ["405799197903155930"]', ['405799197903155930'], ['7', False]], ['control ["445793197510028320"]', ['445793197510028320'], ['X', False]], ['control ["309071197409120443"]', ['309071197409120443'], ['3', True]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["309071197409120443"]', ['309071197409120443'], ['3', True]], ['control ["594570196107138355"]', ['594570196107138355'], ['2', False]], ['control ["458825200412201114"]', ['458825200412201114'], ['5', False]], ['control ["373498196811139070"]', ['373498196811139070'], ['5', False]], ['control ["18951819720314318X"]', ['18951819720314318X'], ['3', False]], ['control ["600025197711283200"]', ['600025197711283200'], ['5', False]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["600025197711283200"]', ['600025197711283200'], ['5', False]], ['control ["197110195609245785"]', ['197110195609245785'], ['6', False]], ['control ["37858219960314414X"]', ['37858219960314414X'], ['7', False]], ['control ["22100419730209591X"]', ['22100419730209591X'], ['4', False]], ['control ["653847197508233493"]', ['653847197508233493'], ['2', False]], ['control ["438548195709105267"]', ['438548195709105267'], ['4', False]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["438548195709105267"]', ['438548195709105267'], ['4', False]], ['control ["261917197009053555"]', ['261917197009053555'], ['3', False]], ['control ["607248198301138071"]', ['607248198301138071'], ['9', False]], ['control ["148107199504128670"]', ['148107199504128670'], ['3', False]], ['control ["116248195409054166"]', ['116248195409054166'], ['7', False]], ['control ["306465200011013206"]', ['306465200011013206'], ['6', True]]], [['regression ["11010519491231002x"]', ['11010519491231002x'], ['X', True]], ['partial-repair ["50937819800315206x"]', ['50937819800315206x'], ['9', False]], ['control ["306465200011013206"]', ['306465200011013206'], ['6', True]], ['control ["11010519491231002X"]', ['11010519491231002X'], ['X', True]], ['control ["110105194912310021"]', ['110105194912310021'], ['X', False]], ['control ["440524188001010014"]', ['440524188001010014'], ['4', True]], ['control ["11010519491231002"]', ['11010519491231002'], 'malformed'], ['control ["1101051949123100XX"]', ['1101051949123100XX'], 'malformed']]]
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 ["11010519491231002x"] | ['X', True] | ['X', True] | Passed |
| partial-repair ["50937819800315206x"] | ['9', False] | ['9', False] | Passed |
| control ["268310199103143528"] | ['9', False] | ['9', False] | Passed |
| control ["297547197007199229"] | ['2', False] | ['2', False] | Passed |
| control ["518849198106269933"] | ['6', False] | ['6', False] | Passed |
| control ["405799197903155930"] | ['7', False] | ['7', False] | Passed |
| control ["445793197510028320"] | ['X', False] | ['X', False] | Passed |
| control ["309071197409120443"] | ['3', True] | ['3', True] | Passed |
SHA-256 / 466c6ece2c37aa1fec6b2875f02b79c1d03ed4834191f734ff8f560435702444
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:39.773142+00:00.
Case digest / 2979b0995fc5aeb0c205fc177969e8d1851ec6909021f1a867059876d8a16043