Subject: Check-Digit in HKID

From: KEUNG Kai Chung <[email-masked]>
Date: Tue, 28 Oct 2003 22:28:50 +0800

Hello Nick,

Here is the calculation of check-digit in HKID.

First, convert the first letter into a number according to the following:
A, L, W >> 1
B, M, X >> 2
C, N, Y >> 3
D, O, Z >> 4
E, P    >> 5
F, Q    >> 6
G, R    >> 7
H, S    >> 8
I, T    >> 9
J, U    >> 10
K, V    >> 11

Then, multiply the first seven numbers by 8, 7, 6, 5, 4, 3 and 2 respectively. After that, calculate the sum. Find the remainder when divided by 11. Finally, the check-digit is the result of subtract the remainder from 11. (if the check-digit is 10, represented by A)

For example, the HKID is H123456(?)
1. convert 'H' to 8
2. (8*8) + (1*7) + (2*6) + (3*5) + (4*4) + (5*3) + (6*2) = 141
3. 141/11 = 12, remainder is 9
4. 11 - 9 = 2
so, the HKID is H123456(2)

Hope the above information is useful for you.

Chung