FAILURE MAP
← Case archive

FA-72486 / Check-digit algorithms / Open access

IBAN print format keeps interior spaces · case 01

IBANs copied in groups of four are reported malformed.

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

ROOT CAUSE

Only leading and trailing whitespace is stripped, so the grouping spaces fail the alphanumeric test.

THE FAILURE

Only leading and trailing whitespace is stripped, so the grouping spaces fail the alphanumeric test.

Unsuccessful approach: Removing spaces without upper-casing leaves lowercase input unknown to the country table.

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.strip().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 == 1 else 'invalid'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["DE59 8119 0313 8375 2911 24"]', ['DE59 8119 0313 8375 2911 24'], 'valid'], ['regression ["DE50 2964 9612 3032 3544 76"]', ['DE50 2964 9612 3032 3544 76'], 'valid'], ['partial-repair ["gb23hjgz79203524065161"]', ['gb23hjgz79203524065161'], 'valid'], ['partial-repair ["fr88hio0qy01nrb0vcrb14qo450"]', ['fr88hio0qy01nrb0vcrb14qo450'], 'valid'], ['control ["DE59811903138375291124"]', ['DE59811903138375291124'], 'valid'], ['control ["DE50296496123032354476"]', ['DE50296496123032354476'], 'valid'], ['control ["DE58862288567935243525"]', ['DE58862288567935243525'], 'valid'], ['control ["GB12YUBO17171961366336"]', ['GB12YUBO17171961366336'], 'valid']], [['regression ["GB12 YUBO 1717 1961 3663 36"]', ['GB12 YUBO 1717 1961 3663 36'], 'valid'], ['regression ["GB30 TWRL 0917 7880 2336 95"]', ['GB30 TWRL 0917 7880 2336 95'], 'valid'], ['partial-repair ["fr87b5lpn0gwm8frhg96jym18v0"]', ['fr87b5lpn0gwm8frhg96jym18v0'], 'valid'], ['partial-repair ["gb82west12345698765432"]', ['gb82west12345698765432'], 'valid'], ['control ["GB23HJGZ79203524065161"]', ['GB23HJGZ79203524065161'], 'valid'], ['control ["FR88HIO0QY01NRB0VCRB14QO450"]', ['FR88HIO0QY01NRB0VCRB14QO450'], 'valid'], ['control ["FR38Q7OJKEPW4X8D3YP3O6RO9CF"]', ['FR38Q7OJKEPW4X8D3YP3O6RO9CF'], 'valid'], ['control ["FR87B5LPN0GWM8FRHG96JYM18V0"]', ['FR87B5LPN0GWM8FRHG96JYM18V0'], 'valid']], [['regression ["DE59 8119 0313 8375 2911 24"]', ['DE59 8119 0313 8375 2911 24'], 'valid'], ['regression ["DE50 2964 9612 3032 3544 76"]', ['DE50 2964 9612 3032 3544 76'], 'valid'], ['partial-repair ["fr88hio0qy01nrb0vcrb14qo450"]', ['fr88hio0qy01nrb0vcrb14qo450'], 'valid'], ['partial-repair ["fr38q7ojkepw4x8d3yp3o6ro9cf"]', ['fr38q7ojkepw4x8d3yp3o6ro9cf'], 'valid'], ['control ["NL15KCEZ0926524218"]', ['NL15KCEZ0926524218'], 'valid'], ['control ["NL97OZQU5858488442"]', ['NL97OZQU5858488442'], 'valid'], ['control ["BE73177155519075"]', ['BE73177155519075'], 'valid'], ['control ["BE31287393626938"]', ['BE31287393626938'], 'valid']], [['regression ["GB12 YUBO 1717 1961 3663 36"]', ['GB12 YUBO 1717 1961 3663 36'], 'valid'], ['regression ["GB30 TWRL 0917 7880 2336 95"]', ['GB30 TWRL 0917 7880 2336 95'], 'valid'], ['partial-repair ["gb82west12345698765432"]', ['gb82west12345698765432'], 'valid'], ['partial-repair ["gb23hjgz79203524065161"]', ['gb23hjgz79203524065161'], 'valid'], ['control ["NO5861733992430"]', ['NO5861733992430'], 'valid'], ['control ["NO7438063392154"]', ['NO7438063392154'], 'valid'], ['control ["NO8414946034784"]', ['NO8414946034784'], 'valid'], ['control ["MT48QBGB31246251447244909393188"]', ['MT48QBGB31246251447244909393188'], 'valid']], [['regression ["DE59 8119 0313 8375 2911 24"]', ['DE59 8119 0313 8375 2911 24'], 'valid'], ['regression ["DE50 2964 9612 3032 3544 76"]', ['DE50 2964 9612 3032 3544 76'], 'valid'], ['partial-repair ["fr38q7ojkepw4x8d3yp3o6ro9cf"]', ['fr38q7ojkepw4x8d3yp3o6ro9cf'], 'valid'], ['partial-repair ["fr87b5lpn0gwm8frhg96jym18v0"]', ['fr87b5lpn0gwm8frhg96jym18v0'], 'valid'], ['control ["MT98JHCG63199638448964680432116"]', ['MT98JHCG63199638448964680432116'], 'valid'], ['control ["DE59811903138375291127"]', ['DE59811903138375291127'], 'invalid'], ['control ["DE50296496123032354477"]', ['DE50296496123032354477'], 'invalid'], ['control ["DE58862288567935243527"]', ['DE58862288567935243527'], 'invalid']]]
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 ["DE59 8119 0313 8375 2911 24"]malformedvalidFailed
regression ["DE50 2964 9612 3032 3544 76"]malformedvalidFailed
partial-repair ["gb23hjgz79203524065161"]validvalidPassed
partial-repair ["fr88hio0qy01nrb0vcrb14qo450"]validvalidPassed
control ["DE59811903138375291124"]validvalidPassed
control ["DE50296496123032354476"]validvalidPassed
control ["DE58862288567935243525"]validvalidPassed
control ["GB12YUBO17171961366336"]validvalidPassed

SHA-256 / 67c6f61039a4a3d020ef18cabb5aac325749bb7fc415bef937550d61033abe65

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(' ', '')
    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 == 1 else 'invalid'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["DE59 8119 0313 8375 2911 24"]', ['DE59 8119 0313 8375 2911 24'], 'valid'], ['regression ["DE50 2964 9612 3032 3544 76"]', ['DE50 2964 9612 3032 3544 76'], 'valid'], ['partial-repair ["gb23hjgz79203524065161"]', ['gb23hjgz79203524065161'], 'valid'], ['partial-repair ["fr88hio0qy01nrb0vcrb14qo450"]', ['fr88hio0qy01nrb0vcrb14qo450'], 'valid'], ['control ["DE59811903138375291124"]', ['DE59811903138375291124'], 'valid'], ['control ["DE50296496123032354476"]', ['DE50296496123032354476'], 'valid'], ['control ["DE58862288567935243525"]', ['DE58862288567935243525'], 'valid'], ['control ["GB12YUBO17171961366336"]', ['GB12YUBO17171961366336'], 'valid']], [['regression ["GB12 YUBO 1717 1961 3663 36"]', ['GB12 YUBO 1717 1961 3663 36'], 'valid'], ['regression ["GB30 TWRL 0917 7880 2336 95"]', ['GB30 TWRL 0917 7880 2336 95'], 'valid'], ['partial-repair ["fr87b5lpn0gwm8frhg96jym18v0"]', ['fr87b5lpn0gwm8frhg96jym18v0'], 'valid'], ['partial-repair ["gb82west12345698765432"]', ['gb82west12345698765432'], 'valid'], ['control ["GB23HJGZ79203524065161"]', ['GB23HJGZ79203524065161'], 'valid'], ['control ["FR88HIO0QY01NRB0VCRB14QO450"]', ['FR88HIO0QY01NRB0VCRB14QO450'], 'valid'], ['control ["FR38Q7OJKEPW4X8D3YP3O6RO9CF"]', ['FR38Q7OJKEPW4X8D3YP3O6RO9CF'], 'valid'], ['control ["FR87B5LPN0GWM8FRHG96JYM18V0"]', ['FR87B5LPN0GWM8FRHG96JYM18V0'], 'valid']], [['regression ["DE59 8119 0313 8375 2911 24"]', ['DE59 8119 0313 8375 2911 24'], 'valid'], ['regression ["DE50 2964 9612 3032 3544 76"]', ['DE50 2964 9612 3032 3544 76'], 'valid'], ['partial-repair ["fr88hio0qy01nrb0vcrb14qo450"]', ['fr88hio0qy01nrb0vcrb14qo450'], 'valid'], ['partial-repair ["fr38q7ojkepw4x8d3yp3o6ro9cf"]', ['fr38q7ojkepw4x8d3yp3o6ro9cf'], 'valid'], ['control ["NL15KCEZ0926524218"]', ['NL15KCEZ0926524218'], 'valid'], ['control ["NL97OZQU5858488442"]', ['NL97OZQU5858488442'], 'valid'], ['control ["BE73177155519075"]', ['BE73177155519075'], 'valid'], ['control ["BE31287393626938"]', ['BE31287393626938'], 'valid']], [['regression ["GB12 YUBO 1717 1961 3663 36"]', ['GB12 YUBO 1717 1961 3663 36'], 'valid'], ['regression ["GB30 TWRL 0917 7880 2336 95"]', ['GB30 TWRL 0917 7880 2336 95'], 'valid'], ['partial-repair ["gb82west12345698765432"]', ['gb82west12345698765432'], 'valid'], ['partial-repair ["gb23hjgz79203524065161"]', ['gb23hjgz79203524065161'], 'valid'], ['control ["NO5861733992430"]', ['NO5861733992430'], 'valid'], ['control ["NO7438063392154"]', ['NO7438063392154'], 'valid'], ['control ["NO8414946034784"]', ['NO8414946034784'], 'valid'], ['control ["MT48QBGB31246251447244909393188"]', ['MT48QBGB31246251447244909393188'], 'valid']], [['regression ["DE59 8119 0313 8375 2911 24"]', ['DE59 8119 0313 8375 2911 24'], 'valid'], ['regression ["DE50 2964 9612 3032 3544 76"]', ['DE50 2964 9612 3032 3544 76'], 'valid'], ['partial-repair ["fr38q7ojkepw4x8d3yp3o6ro9cf"]', ['fr38q7ojkepw4x8d3yp3o6ro9cf'], 'valid'], ['partial-repair ["fr87b5lpn0gwm8frhg96jym18v0"]', ['fr87b5lpn0gwm8frhg96jym18v0'], 'valid'], ['control ["MT98JHCG63199638448964680432116"]', ['MT98JHCG63199638448964680432116'], 'valid'], ['control ["DE59811903138375291127"]', ['DE59811903138375291127'], 'invalid'], ['control ["DE50296496123032354477"]', ['DE50296496123032354477'], 'invalid'], ['control ["DE58862288567935243527"]', ['DE58862288567935243527'], 'invalid']]]
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 ["DE59 8119 0313 8375 2911 24"]validvalidPassed
regression ["DE50 2964 9612 3032 3544 76"]validvalidPassed
partial-repair ["gb23hjgz79203524065161"]malformedvalidFailed
partial-repair ["fr88hio0qy01nrb0vcrb14qo450"]malformedvalidFailed
control ["DE59811903138375291124"]validvalidPassed
control ["DE50296496123032354476"]validvalidPassed
control ["DE58862288567935243525"]validvalidPassed
control ["GB12YUBO17171961366336"]validvalidPassed

SHA-256 / eef5fbb0b7ee9dc64887c91644df4d6854f7cb0da0e9a682686ad71d759c6d26

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:38.996864+00:00.

Case digest / 125f861afb72120a20178358f9ac2d0006093063a08fbeb1092eb8255b0dde23