The checksum algorithm for Mode 10 is to use “Luhn algorithm”:
- Counting from the check digit, which is the rightmost one, and moving left, double (x 2) the value of every second digit.
- Sum the digits of the products (eg, 10 ⇒ 1+0 = 1, 14 ⇒ 1+ 4 =5) together with the un-doubled digits from the original number
- Got the sum, then do: sum Mod 10 = check digit
Assume an example of an account number "1234567" that will have a check digit added, making it of the form “1234567X”:
Then the steps to calculate the X are:
Table 2.2. Mode 10 Check Digit Example
Example | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Mode 10 Check digit |
---|---|---|---|---|---|---|---|---|
(1) Append X | 1 | 2 | 3 | 4 | 5 | 6 | 7 | X |
(2) From rightmost, every second digit × 2 | 2 | 6 | 10 | 14 | ||||
(3) List all | 2 | 2 | 6 | 4 | 1+0 | 6 | 1+4 | |
(4) Got Summary | Sum=2+2+6+4+1+0+6+1+4=26, 26 Mod 10 = 4 | X = 4 | ||||||
(5)Result | 12345674 |
For the second checksum digit, the calculation method is still the same, just take the “12345674” as the input number, the calculate the X for “12345674X”