🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Sherine Wed, 12 Apr 2023 06:16
Re: calculate hkid check digit program
#1
Author: Sherine
Date: Wed, 12 Apr 2023 06:16
32 lines
2653 bytes
On Tuesday, 6 January 1998 at 16:00:00 UTC+8, Philip Lam wrote:
> 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 >>


I am wondering why is MOD(total) with 11? why 11? 
Thanks 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads