Luhnalgoritmilla
Luhnalgoritmilla, also known as the Luhn algorithm or Luhn formula, is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers and Canadian Social Insurance Numbers. The algorithm was created by IBM scientist Hans Peter Luhn in 1954. It works by performing a modulus operation on the processed number. Here's a step-by-step breakdown of the algorithm:
1. Starting from the rightmost digit (which is the check digit), double the value of every second
2. If doubling a number results in a number greater than 9, subtract 9 from the result.
4. If the total modulo 10 is equal to 0, then the number is valid according to
The Luhn algorithm is widely used due to its simplicity and effectiveness in detecting errors in identification