FA-72491 / Check-digit algorithms / Open access
IBAN validity expects remainder zero · case 01
Every valid IBAN fails and certain wrong ones pass.
ROOT CAUSE
The rearranged number is tested for % 97 == 0; correct IBANs leave remainder 1.
THE FAILURE
The rearranged number is tested for % 97 == 0; correct IBANs leave remainder 1.
Unsuccessful approach: Accepting remainder 0 or 1 admits IBANs whose check digits are off by one.
Case contract
IBAN validation for the countries DE 22, GB 22, FR 27, NL 18, BE 16, NO 15, MT 31 (other countries: "malformed"). Spaces (print format) are removed and letters are upper-cased. The check digits must be 02..98. Move the first four characters to the end, replace letters with 10..35, and the IBAN is "valid" when the number is 1 mod 97.
Why this case matters
Payment initiation rejects mistyped account identifiers before submitting transfers.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
LENGTHS = {'DE': 22, 'GB': 22, 'FR': 27, 'NL': 18, 'BE': 16, 'NO': 15, 'MT': 31}
t = s.replace(' ', '').upper()
if len(t) < 5 or not t.isascii() or not t.isalnum():
return 'malformed'
if not t[:2].isalpha() or not t[2:4].isdigit() or not 2 <= int(t[2:4]) <= 98:
return 'malformed'
if LENGTHS.get(t[:2]) != len(t):
return 'malformed'
r = t[4:] + t[:4]
n = ''.join(str(int(ch, 36)) for ch in r)
return 'valid' if int(n) % 97 == 0 else 'invalid'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["DE59811903138375291124"]', ['DE59811903138375291124'], 'valid'], ['regression ["DE50296496123032354476"]', ['DE50296496123032354476'], 'valid'], ['partial-repair ["DE58811903138375291124"]', ['DE58811903138375291124'], 'invalid'], ['partial-repair ["DE49296496123032354476"]', ['DE49296496123032354476'], 'invalid'], ['control ["DE59811903138375291127"]', ['DE59811903138375291127'], 'invalid'], ['control ["DE50296496123032354477"]', ['DE50296496123032354477'], 'invalid'], ['control ["DE58862288567935243527"]', ['DE58862288567935243527'], 'invalid'], ['control ["GB12YUBO17171961366337"]', ['GB12YUBO17171961366337'], 'invalid']], [['regression ["GB12YUBO17171961366336"]', ['GB12YUBO17171961366336'], 'valid'], ['regression ["GB30TWRL09177880233695"]', ['GB30TWRL09177880233695'], 'valid'], ['partial-repair ["GB11YUBO17171961366336"]', ['GB11YUBO17171961366336'], 'invalid'], ['partial-repair ["GB29TWRL09177880233695"]', ['GB29TWRL09177880233695'], 'invalid'], ['control ["GB23HJGZ79203524065167"]', ['GB23HJGZ79203524065167'], 'invalid'], ['control ["DE00050434738327048798"]', ['DE00050434738327048798'], 'malformed'], ['control ["DE01819403115748858673"]', ['DE01819403115748858673'], 'malformed'], ['control ["DE01435241396484727591"]', ['DE01435241396484727591'], 'malformed']], [['regression ["FR88HIO0QY01NRB0VCRB14QO450"]', ['FR88HIO0QY01NRB0VCRB14QO450'], 'valid'], ['regression ["FR38Q7OJKEPW4X8D3YP3O6RO9CF"]', ['FR38Q7OJKEPW4X8D3YP3O6RO9CF'], 'valid'], ['partial-repair ["DE58811903138375291124"]', ['DE58811903138375291124'], 'invalid'], ['partial-repair ["DE49296496123032354476"]', ['DE49296496123032354476'], 'invalid'], ['control ["XX82WEST12345698765432"]', ['XX82WEST12345698765432'], 'malformed'], ['control ["US64SVBKUS6S3300958879"]', ['US64SVBKUS6S3300958879'], 'malformed'], ['control ["GB82WEST1234569876543"]', ['GB82WEST1234569876543'], 'malformed'], ['control ["GB82-WEST-1234"]', ['GB82-WEST-1234'], 'malformed']], [['regression ["NL34HYUK1800961826"]', ['NL34HYUK1800961826'], 'valid'], ['regression ["NL15KCEZ0926524218"]', ['NL15KCEZ0926524218'], 'valid'], ['partial-repair ["GB11YUBO17171961366336"]', ['GB11YUBO17171961366336'], 'invalid'], ['partial-repair ["GB29TWRL09177880233695"]', ['GB29TWRL09177880233695'], 'invalid'], ['control ["NO0886011117947"]', ['NO0886011117947'], 'invalid'], ['control ["DE59811903138375291127"]', ['DE59811903138375291127'], 'invalid'], ['control ["DE50296496123032354477"]', ['DE50296496123032354477'], 'invalid'], ['control ["DE58862288567935243527"]', ['DE58862288567935243527'], 'invalid']], [['regression ["BE73177155519075"]', ['BE73177155519075'], 'valid'], ['regression ["BE31287393626938"]', ['BE31287393626938'], 'valid'], ['partial-repair ["DE58811903138375291124"]', ['DE58811903138375291124'], 'invalid'], ['partial-repair ["DE49296496123032354476"]', ['DE49296496123032354476'], 'invalid'], ['control ["GB30TWRL09177880233697"]', ['GB30TWRL09177880233697'], 'invalid'], ['control ["GB23HJGZ79203524065167"]', ['GB23HJGZ79203524065167'], 'invalid'], ['control ["DE00050434738327048798"]', ['DE00050434738327048798'], 'malformed'], ['control ["DE01819403115748858673"]', ['DE01819403115748858673'], '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 ["DE59811903138375291124"] | invalid | valid | Failed |
| regression ["DE50296496123032354476"] | invalid | valid | Failed |
| partial-repair ["DE58811903138375291124"] | valid | invalid | Failed |
| partial-repair ["DE49296496123032354476"] | valid | invalid | Failed |
| control ["DE59811903138375291127"] | invalid | invalid | Passed |
| control ["DE50296496123032354477"] | invalid | invalid | Passed |
| control ["DE58862288567935243527"] | invalid | invalid | Passed |
| control ["GB12YUBO17171961366337"] | invalid | invalid | Passed |
SHA-256 / 17eb6cc595ffd63820ae7f49e852dc824f84e7b20143f4215be2f83a0c98a224
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
LENGTHS = {'DE': 22, 'GB': 22, 'FR': 27, 'NL': 18, 'BE': 16, 'NO': 15, 'MT': 31}
t = s.replace(' ', '').upper()
if len(t) < 5 or not t.isascii() or not t.isalnum():
return 'malformed'
if not t[:2].isalpha() or not t[2:4].isdigit() or not 2 <= int(t[2:4]) <= 98:
return 'malformed'
if LENGTHS.get(t[:2]) != len(t):
return 'malformed'
r = t[4:] + t[:4]
n = ''.join(str(int(ch, 36)) for ch in r)
return 'valid' if int(n) % 97 in (0, 1) else 'invalid'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["DE59811903138375291124"]', ['DE59811903138375291124'], 'valid'], ['regression ["DE50296496123032354476"]', ['DE50296496123032354476'], 'valid'], ['partial-repair ["DE58811903138375291124"]', ['DE58811903138375291124'], 'invalid'], ['partial-repair ["DE49296496123032354476"]', ['DE49296496123032354476'], 'invalid'], ['control ["DE59811903138375291127"]', ['DE59811903138375291127'], 'invalid'], ['control ["DE50296496123032354477"]', ['DE50296496123032354477'], 'invalid'], ['control ["DE58862288567935243527"]', ['DE58862288567935243527'], 'invalid'], ['control ["GB12YUBO17171961366337"]', ['GB12YUBO17171961366337'], 'invalid']], [['regression ["GB12YUBO17171961366336"]', ['GB12YUBO17171961366336'], 'valid'], ['regression ["GB30TWRL09177880233695"]', ['GB30TWRL09177880233695'], 'valid'], ['partial-repair ["GB11YUBO17171961366336"]', ['GB11YUBO17171961366336'], 'invalid'], ['partial-repair ["GB29TWRL09177880233695"]', ['GB29TWRL09177880233695'], 'invalid'], ['control ["GB23HJGZ79203524065167"]', ['GB23HJGZ79203524065167'], 'invalid'], ['control ["DE00050434738327048798"]', ['DE00050434738327048798'], 'malformed'], ['control ["DE01819403115748858673"]', ['DE01819403115748858673'], 'malformed'], ['control ["DE01435241396484727591"]', ['DE01435241396484727591'], 'malformed']], [['regression ["FR88HIO0QY01NRB0VCRB14QO450"]', ['FR88HIO0QY01NRB0VCRB14QO450'], 'valid'], ['regression ["FR38Q7OJKEPW4X8D3YP3O6RO9CF"]', ['FR38Q7OJKEPW4X8D3YP3O6RO9CF'], 'valid'], ['partial-repair ["DE58811903138375291124"]', ['DE58811903138375291124'], 'invalid'], ['partial-repair ["DE49296496123032354476"]', ['DE49296496123032354476'], 'invalid'], ['control ["XX82WEST12345698765432"]', ['XX82WEST12345698765432'], 'malformed'], ['control ["US64SVBKUS6S3300958879"]', ['US64SVBKUS6S3300958879'], 'malformed'], ['control ["GB82WEST1234569876543"]', ['GB82WEST1234569876543'], 'malformed'], ['control ["GB82-WEST-1234"]', ['GB82-WEST-1234'], 'malformed']], [['regression ["NL34HYUK1800961826"]', ['NL34HYUK1800961826'], 'valid'], ['regression ["NL15KCEZ0926524218"]', ['NL15KCEZ0926524218'], 'valid'], ['partial-repair ["GB11YUBO17171961366336"]', ['GB11YUBO17171961366336'], 'invalid'], ['partial-repair ["GB29TWRL09177880233695"]', ['GB29TWRL09177880233695'], 'invalid'], ['control ["NO0886011117947"]', ['NO0886011117947'], 'invalid'], ['control ["DE59811903138375291127"]', ['DE59811903138375291127'], 'invalid'], ['control ["DE50296496123032354477"]', ['DE50296496123032354477'], 'invalid'], ['control ["DE58862288567935243527"]', ['DE58862288567935243527'], 'invalid']], [['regression ["BE73177155519075"]', ['BE73177155519075'], 'valid'], ['regression ["BE31287393626938"]', ['BE31287393626938'], 'valid'], ['partial-repair ["DE58811903138375291124"]', ['DE58811903138375291124'], 'invalid'], ['partial-repair ["DE49296496123032354476"]', ['DE49296496123032354476'], 'invalid'], ['control ["GB30TWRL09177880233697"]', ['GB30TWRL09177880233697'], 'invalid'], ['control ["GB23HJGZ79203524065167"]', ['GB23HJGZ79203524065167'], 'invalid'], ['control ["DE00050434738327048798"]', ['DE00050434738327048798'], 'malformed'], ['control ["DE01819403115748858673"]', ['DE01819403115748858673'], '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 ["DE59811903138375291124"] | valid | valid | Passed |
| regression ["DE50296496123032354476"] | valid | valid | Passed |
| partial-repair ["DE58811903138375291124"] | valid | invalid | Failed |
| partial-repair ["DE49296496123032354476"] | valid | invalid | Failed |
| control ["DE59811903138375291127"] | invalid | invalid | Passed |
| control ["DE50296496123032354477"] | invalid | invalid | Passed |
| control ["DE58862288567935243527"] | invalid | invalid | Passed |
| control ["GB12YUBO17171961366337"] | invalid | invalid | Passed |
SHA-256 / 6997b7888dd4e91e2e1d7acf2fb9d0e0ad274e9e42c4163fa6b4f4c7961fc7d7
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 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.037611+00:00.
Case digest / fa7977c38eb6d46ea6ae981282ec05efb725aa1dd4e41fd398fc6cb12d310e62