Weighted MOD 23 Check Digit 追蹤
Struggling to get my head around a specific Check Digit requirement. Hope someone with a bit of VBA knowledge may be able to help?
I have a 13 digit serial number that is required to be shown as text, with a check digit at the end. Example: BGNL10260123H - where H would be the Check Digit.
Each character in the serial must then be converted into a number.
0 = 48, 1 = 49, upto 9 = 57, then letters A = 65, through to Z = 90.
Each character in the serial number is weighted by its position in the serial:
Position 1 = Weight of 9, down to Position 8 = Weight 2
Then 9 = Weight 10 up to 12 = Weight 13. The final digit has a weight of 0.
Then the converted number is multiplied by the position weight to give a position value.
The position values for each character are then added together and a MOD 23 is applied.
The result of the MOD 23 is then converted into a letter.
As you may be able to tell, this is quite complicated. Can anyone point me in the right direction?