Below are the steps for generating the check digit.
1. The first letter of the card number is converted into a number based on its position in the alphabetical sequence (i.e., A = 1, B = 2, C = 3, …, Z = 26), and is multiplied by 8.
2. The following six digits of the card number are multiplied by 7, 6, 5, 4, 3 and 2 respectively.
3. The products are then summed up, and the remainder of dividing this sum by 11 is computed.
4. The check digit is computed by subtracting the remainder from 11. If the subtraction produces 11, the check digit will be replaced by the digit ‘0’. If the subtraction produced 10, the check digit will be replaced by the letter ‘A’.
Take the card number C668668 in the sample HKID card in fig. 1 as an example. The first letter ‘C’ is converted into 3. The sum is then computed as 3×8 + 6×7 + 6×6 + 8×5 + 6×4 + 6×3 + 8×2 = 200. The remainder of dividing 200 by 11 is 2. The check digit is therefore given by 11 – 2 = 9. Hence, the card number (with check digit) C668668(E) in the sample HKID card is invalid! The correct card number (with check digit) should be C668668(9).
Jumper_1 0 Newbie Poster
Jumper_1 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.