Calculating minimum Hamming distance (from number of error detections in code) of an IBAN bank code

197 Views Asked by At

Algorithm for checking validity of IBAN code is well known:

1. Check that the total IBAN length is correct as per the country. If not, the IBAN is invalid
2. Move the four initial characters to the end of the string
3. Replace each letter in the string with two digits, thereby expanding the string, where A = 10, B = 11, ..., Z = 35
4. Interpret the string as a decimal integer and compute the remainder of that number on division by 97

If the remainder is 1, the check digit test is passed and the IBAN might be valid.

But how I can calculate minimum Hamming distance of IBAN code (for one particular country)?

I know how to calculate this for easier ISBN-10:

Suppose a <-> y:

$$ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,CASE\, 1: 10y + 9b +....+ j ≠ 0 \, mod\, 11 <-- ERROR $$

$$ CASE\, 2: -10a + 9b + ... + j = 0\, mod\, 11 $$

$$ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,- (10a + 9b + ... + j) = 0\, mod\, 11$$


$$ 10 (y - a) = 0 \, mod \, 11 $$ $$ y - a = 0 \, mod\, 11$$ $$ y = a \, mod\, 11$$ $$ y = a $$

$$ Because: \,y,a ∈ { 0,1,....,9 }$$

THERE WAS AN ERROR.

Because we showed ISBN is a single error detecting code, every pair of codewords has Hamming distance at least 2.

Can it be also shown in this way for IBAN code for particular country in this way? Just with longer equation?

For 22 characters long IBAN:

22a + 21b ... = 1 mod 97

But how do I deal with country code (UK = 1611) which needs to stay always same?