Logic behind the ID checksum?

1.4k Views Asked by At

I'm a resident of Kuwait and I just learnt that the CIVIL ID numbers allotted to us follow a checksum. The ID is 12 digit number following the algorithm below -

11 – Mod(( c1 * 2 ) + ( c2 * 1 ) + ( c3 * 6 ) + ( c4 * 3 ) + ( c5 * 7 ) +
( c6 * 9 ) + ( c7 * 10 ) + ( c8 * 5 ) + ( c9 * 8 ) + ( c10 * 4 ) + ( c11 * 2 )),11) = 
The 12th Digit

Here, Cx are the digits in the Civil ID number.

Can someone tell me what is the reasoning behind the coefficients used in the checksum? The Bulgarian civil number also uses a checksum but the algorithm used there uses powers of 2 modulus 11. More info here.

Thanks

2

There are 2 best solutions below

4
On BEST ANSWER

Rephrasing your equation slightly, the check condition is $$(2,1,6,3,7,9,10,5,8,4,2)\cdot c_{1\ldots 11} + c_{12} \equiv 0\pmod {11}$$

If you take first differences of that vector modulo 11 you get $(10,5,8,4,2,1,6,3,7,9)$, which is $(2^5,2^4,2^3,2^2,2^1,2^0,2^9,2^8,2^7,2^6)$.

0
On

Check out the discussion on the Luhn algorithm and the Verhoeff algorithm. The idea is to catch simple transcription errors (mistaken digits, leftouts, switched digits) that are common when copying long numbers by hand. The mathematics behind the Verhoeff algorithm is a bit unusual (it takes each digit to be an operation in a dihedral group, and applies to the digit in position $i$ the permutation $\sigma^i$, where $\sigma$ is a given permutation, and then operates the results) it is not hard to see it catches all simple errors (digit changes, transpositions).