Sunday, September 30, 2007

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.

Examples
The final digit of a Universal Product Code is a check digit computed as follows:
For instance, a UPC-A barcode (In this case, a UPC for a box of tissues) "03600029145X" where X is the check digit, X can be calculated by adding the odd-numbered digits (0+6+0+2+1+5 = 14), multiplying by three (14 × 3 = 42), adding the even-numbered digits (42+3+0+0+9+4 = 58) and subtracting from the next-highest multiple of ten (60 - 58 = 2). The check digit is thus 2.

Add the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three.
Add the digits in the even-numbered positions (second, fourth, sixth, etc.) to the result.
Subtract the result from the next-higher multiple of ten. The answer is the check digit.

No comments: