Validation and Verification : Check Digit

The check digit is a particularly important method of validation. It is used to ensure that code numbers that are originally produced by a computer are re-entered into another computer correctly. The check digit is a single digit added onto the end of a code number by the computer. The check digit is calculated from the other digits in the number. Check digits are included in bar code numbers.

Producing a Check Digit

This procedure is used to generate a check digit to add to the end of a number. It uses the Modulo-11 weighted check digit calculation. This calculation is used for ISBN numbers on books.

1) Start with the original product number e.g. 185813415.
2) Weight each digit by its position in the string and add up the results. Note that the lowest weight used is 2 :

Digit185813415 
Weightings*10*9*8*7*6*5*4*3*2Total
Result1072405661516310228
 
3) Divide the total by 11 and then subtract the remainder from 11. The check digit is the result of this operation :

228 / 11 = 20 remainder 8 =>

If the remainder is 10 then the check digit is set to X. If it is 0 then the check digit is 0

As the remainder is neither 10 nor 0, the check digit is calculated like this :

Check digit is 11-remainder = 11-8 = 3.

4)Add the check digit to the end of the original number to get the complete product number : 1858134143

Validating a Number Including a Check Digit

The procedure to check if a number with a check digit in it has been inputted correctly is similar to that used to generated the check digit :

1)Input the number including the check digit. e.g. 1858134153.
2)Weight each digit by its position in the string and add up the results :

Digit1858134153 
Weightings*10*9*8*7*6*5*4*3*2*1Total
Result10724056615163103231
 If the last digit in the number is an X then it is treated as the number 10.
3)Divide the total by 11.

231 / 11 = 21 remainder 0

4)If the reminder is 0 then the number has passed the validation check and so it is likely that it has been inputted correctly.

It is important that each digit is weighted before the numbers are added up. If this was not done then a check digit would not detect transposition errors (where two digits are swapped around). This is a particularly common form of error when numbers are typed.

GCSE ICT Companion 04 - (C) P Meakin 2004