Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

calculate hkid check digit program

100 views
Skip to first unread message

PAUL MAK

unread,
Jan 6, 1998, 3:00:00 AM1/6/98
to

Hello all,
I am looking for the source code/algorithm of calculation of hkid
card check digit.
if anyone have this piece of code/program please email to me!!!
many thanks!!


paul mak


Philip Lam

unread,
Jan 6, 1998, 3:00:00 AM1/6/98
to

On Tue, 06 Jan 1998 23:48:55 +0800, PAUL MAK <z...@netvigator.com>
wrote:

> I am looking for the source code/algorithm of calculation of hkid
>card check digit.

Hi Paul,

You may try the following algorithm :

Calculation of the check digit:
===============================
For example, the HKID no. is A123456
^^
1) If there is a "blank" before "A", just like our case, it is treated
as a "]" (91 in ASCII)

2) For other characters, just apply the ASCII value of that character
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in the following formula. (A=65, B=66, .....)

3) A = 65 in ASCII

Total = 91*9 + 65*8 + 1*7 + 2*6 + 3*5 + 4*4 + 5*3 + 6*2
^^
"]" in ASCII

= 1416

MOD(total) with 11 ==> 1416 / 11 = 128 ... 8 (Remainder)
Check digit = 11 - Remainder = 11 - 8 = 3

Therefore the HKID no. is A123456(3)
Check on yourself 'n see if it helps...

Philip Lam
(NOSPAM....@hk.super.net)
<< Remove "NOSPAM." when reply >>

Sherine

unread,
Apr 12, 2023, 2:16:58 AM4/12/23
to
I am wondering why is MOD(total) with 11? why 11?
Thanks
0 new messages