|
|
|
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| trinity notes | Luhn Formula | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
The LUHN formula The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, was developed in the 1960s as a method of validating identification numbers. It is a simple checksum formula used to validate a variety of account numbers, such as credit card numbers. Much of its notoriety comes from credit card companies' adoption of it shortly after its creation in the late 1960s by IBM scientist Hans Peter Luhn (1896-1964). The algorithm is in the public domain and is in wide use today. It is not intended to be cryptographically secure hash function; it protects against random error, not malicious attack. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from collections of random digits. The first part of the credit-card number identifies the type of credit card (Visa, MasterCard, American Express, etc.), and the middle digits identify the bank and customer.
To generate the check digit, the LUHN formula is applied to the number. To validate the credit-card number, the check digit is figured into the formula. Here's how the algorithm works for verifying credit cards; the math is quite simple:
Credit Card Number:
Grand Total: 70 If when we divide the grand total by ten the remainder is 0 the algorithm validates and we can assume that the credit card details have been entered correctly. This does not mean Of course this does not mean that the credit card has been issued by a valid company or that this account has sufficient funds to cover the sale. It is only meant to protect against random error rather than malicious attack. Download the Luhn Formula Excel Demo.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||