The Luhn algorithm is an algorithm developed by Hans Peter Luhn and IBM in 1954. It is also called Luhn Check and Mod Check.
Luhn algorithm is used in 2 ways.
Check digit calculator
Check digit value is a value calculated according to mode 10 over the sum of external check digit values.
The algorithm is as follows:
The rightmost digit is the check digit value.
Starting from the check digit value, we multiply the 1st, 3rd, 5… .. values by 2. (2., 4., 6.… values remain the same.)
If the sum of the values is greater than 9, we add up the numbers and find the sum of the numbers.
All the resulting figures are added together.
The sum of the numbers is multiplied by 9.
The last digit of the obtained digit is the check digit value.