http://computerterminal.blogspot.hk/2005/11/hkid-calculation.html
I found out form the Google Analystic that 1/8 of the visitors to this site is to the post HKID Calculation and 1/3 of the visitors are from Russia(!!!) and USA. So i decide to write that post in English for them.
HK ID number starts from Two English Letters plus 6 digits and end with a check digit in bracket
for example: AB987654(3)
Validate the HKID by the following steps:
1) Replace the leading English alphabet with numberic value following the rules below:
Space = 36 A = 10 B = 11 C = 12 D = 13 E = 14 F = 15
G = 16 H = 17 I = 18 J = 19 K = 20 L = 21M = 22 N = 23 O = 24 P = 25 Q = 26 R = 27S = 28 T = 29 U = 30 V = 31 W = 32 X = 33Y = 34 Z = 35
2) Weighted Total Calculation
A)If double english alphabet digit,e.g. AB987654(3):
Total = 1st Digit x9 + 2nd Digit x8 + 3rd Digit x7 + 4th Digit x6 + 5th Digit x5 + 6th Digit x4 + 7th Digit x3 +8th Digit x2
B) Else if single english alphabet digit,e.g. E364912(5):
E364912(5) = (Space)E364912(5)
Total = 36 x 9 + 1st Digit x8 + 2nd Digit x7 + 3rd Digit x6 + 4th Digit x5 + 5th Digit x4 + 6th Digit x3 + 7th Digit x2
3) CheckDigit Calculation
Remaining= Total modulo 11
IF
a)Remaning = 0:
CheckDigit = 0
b)Remaning = 1:
CheckDigit = A
c)Remaning = [2-10]:
CheckDigit = 11 - Remaining
Example:
HKID:E364912(5)
(PS:E is equal to 14 according to step 1)
324 + 14x8 + 3x7 + 6x6 + 4x5 + 9x4 + 1x3 + 2x2 = 556
556 % 11 = 68
11 - 6 = 5
So E364912(5) is a Valid HKID
Example:
HKID:E364912(5)
(PS:E is equal to 14 according to step 1)
324 + 14x8 + 3x7 + 6x6 + 4x5 + 9x4 + 1x3 + 2x2 = 556
556 % 11 = 68
11 - 6 = 5
So E364912(5) is a Valid HKID
4 comments:
or we can:
HKID:E364912(5)
(PS:A to 1, B to 2, C to 3, so E to 5)
(PS:Weight:8,7,6,5,4,3,2,1)
5x8 + 3x7 + 6x6 + 4x5 + 9x4 + 1x3 + 2x2 = 160
160 % 11 = 6
11 - 6 = 5
So E364912(5) is a Valid HKID
HKD : E364912(5)
A to 1, so E to 5 ; Weight : 3,4,5,6,7,8,9
5*3 + 3 * 4 + 6* 5 + 4 *6 + 9 * 7 + 1 * 8 + 2 * 9
= 15 + 12 + 30 + 24 +63 +8 + 18 = 170
170% 11 = 5
Post a Comment