The examples below describes one approach for applying the
Luhn algorithm on two different ISINs. The difference in the two examples has to do with if there are an odd or even number of digits after converting letters to number. Since the NSIN element can be any alpha numeric sequence (9 characters), an odd number of letters will result in an even number of digits and an even number of letters will result in an odd number of digits. For an odd number of digits, the approach in the first example is used. For an even number of digits, the approach in the second example is used. The
Luhn algorithm can also be applied in the same manner for both types or lengths (alternating multiply the string of digits by 1 and 2, starting from the end of the string), being more generic.
Apple, Inc. Apple, Inc.: ISIN
US0378331005, expanded from
CUSIP 037833100 The main body of the ISIN is the original CUSIP, assigned in the 1970s. The country code "US" has been added on the front, and an additional check digit at the end. The country code indicates the country of issue. The check digit is calculated using the
Luhn algorithm. Convert any letters to numbers by taking the ASCII code of the capital letter and subtracting 55: : U = 30, S = 28. US037833100 -> 30 28 037833100 Collect odd and even characters: : 3028037833100 = (3, 2, 0, 7, 3, 1, 0), (0, 8, 3, 8, 3, 0) Multiply the group containing the rightmost character (which is the
FIRST group) by 2: : (6, 4, 0, 14, 6, 2, 0) Add up the individual digits: : (6 + 4 + 0 + (1 + 4) + 6 + 2 + 0) + (0 + 8 + 3 + 8 + 3 + 0) = 45 Take the 10s modulus of the sum: : 45 mod 10 = 5 Subtract from 10: : 10 − 5 = 5 Take the 10s modulus of the result (this final step is important in the instance where the modulus of the sum is 0, as the resulting check digit would be 10). : 5 mod 10 = 5 So the ISIN check digit is five.
Treasury Corporation of Victoria TREASURY CORP VICTORIA 5 3/4% 2005-2016: ISIN
AU0000XVGZA3. The check digit is calculated using the
Luhn algorithm. Convert any letters to numbers by taking the ASCII code of the capital letter and subtracting 55: : A = 10, G = 16, U = 30, V = 31, X = 33, Z = 35. AU0000XVGZA -> 10 30 0000 33 31 16 35 10. Collect odd and even characters: : 103000003331163510 = (1, 3, 0, 0, 3, 3, 1, 3, 1), (0, 0, 0, 0, 3, 1, 6, 5, 0) Multiply the group containing the rightmost character (which is the
SECOND group) by 2: : (0, 0, 0, 0, 6, 2, 12, 10, 0) Add up the individual digits: : (1 + 3 + 0 + 0 + 3 + 3 + 1 + 3 + 1) + (0 + 0 + 0 + 0 + 6 + 2 + (1 + 2) + (1 + 0) + 0) = 27 Take the 10s modulus of the sum: : 27 mod 10 = 7 Subtract from 10: : 10 − 7 = 3 Take the 10s modulus of the result (this final step is important in the instance where the modulus of the sum is 0, as the resulting check digit would be 10). : 3 mod 10 = 3 So the ISIN check digit is three.
BAE Systems BAE Systems: ISIN
GB0002634946, expanded from SEDOL
000263494 The main body is the
SEDOL, padded on the front with the addition of two zeros. The country code "GB" is then added on the front, and the check digit on the end as in the example above. ==Check-digit flaw in ISIN==