There are two types of Hong Kong AB123456(A)
and A123456(3)
Algorithm of generating the check digit
A=10,B=11,...,Z=35, space=36
Example 1
HKID: AB123456(check digit)
0 = [A*9 + B*8 + 1*7 + 2*6 + 3*5 + 4*4 + 5*3 + 6*2 + (check digit)] % 11
check digit = A*9 + B*8 + 1*7 + 2*6 + 3*5 + 4*4 + 5*3 + 6*2
= 11 - 255 % 11
= 11 - 2
= 9
ps: if check digit == 10 then return A
Example 2
HKID: A123456
check digit = 11 - (36*9 + A*8 + 1*7 + 2*6 + 3*5 + 4*4 + 5*3 + 6*2)
= 11 - 481 % 11
= 11 - 8
= 3
ps: if check digit == 10 then return A