CUSIPs are a 9-digit alphanumeric code to uniquely identify financial security.
https://en.wikipedia.org/wiki/CUSIP
They were invented in 1964 and, given the reliability of data transmission in the 60s, the 9th digit is actually a check digit used to confirm the validity of the first 8 characters. Sometimes even today you may find the reason why you want to check CUSIP, or perhaps a company or service, explicitly decides only to transmit the 8-character CUSIP, even if it defeats the target of the check digit.
Check Digit Generation Procedure:
Convert non-numeric digits to values according to their ordinal position in the alphabet plus 9 (A = 10, B = 11, ... Z = 35) and convert the characters * = 36, @ = 37, # = 38.
Multiply each even digit by 2
If the result of the multiplication is a two-digit number, add the numbers together. (12 = 1 + 2 = 3)
Get the sum of all the values.
Get the floor value of this operation: (10 - (sum modulo 10)) modulo 10.
What is the best / easiest way to get this value in C #?
source
share