Check digit
|
A check digit is a form of redundancy check used for error detection, the decimal equivalent of a binary checksum. It consists of a single digit computed from the other digits in the message.
The final digit of a Universal Product Code is a check digit computed so that summing the even-numbered digits, plus 3 times the odd-numbered digits, modulo 10, is 0. For example, take the UPC 070617006092. The sum of even numbered digits is 7+6+7+0+0+2 = 22, and the sum of the odd-numbered digits is 0+0+1+0+6+9 = 16. The total sum is 22+3×16 = 70 ≡ 0 modulo 10. So the code is valid.
The final character of an International Standard Book Number is a check digit computed so that multiplying each digit by its position in the number (counting from the right) and taking the sum of these products modulo 11, is 0. The last digit (which is multiplied by 1) is the check digit, chosen to make the sum correct. It may need to have the value 10, which is represented as the letter X. For example, take the ISBN 0201530821. The sum of products is 0×10 + 2×9 + 0×8 + 1×7 + 5×6 + 3×5 + 0×4 + 8×3 + 2×2 + 1×1 = 99 ≡ 0 modulo 11. So the ISBN number is valid.
While this may seem more complicated than the first scheme, it can actually computed very simply using two sums, both initialized to 0:
sum1 = sum2 = 0 for (each digit of the ISBN) sum1 = sum1 + digit sum2 = sum2 + sum1
the final sum2 should be a multiple of 11.
Other examples of check digits
- The Australian Tax File Number (based on modulo 11)
- The North American CUSIP number
- Modulo 10 check digits in Credit card account numbers, calculated with the Luhn algorithm.
- POSTNET
Compare to check bit.
External links
- Identification numbers and check digit schemes (http://www.academic.marist.edu/mwa/idsn.htm) (a mathematical explantion of various check digit schemes)