Hubbry Logo
search
logo

Luhn algorithm

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
Luhn algorithm

The Luhn algorithm or Luhn formula (creator: IBM scientist Hans Peter Luhn), also known as the "modulus 10" or "mod 10" algorithm, is a simple check digit formula used to validate a variety of identification numbers. The purpose is to design a numbering scheme in such a way that when a human is entering a number, a computer can quickly check it for errors.

The algorithm is in the public domain and is in wide use today. It is specified in ISO/IEC 7812-1. It is not intended to be a cryptographically secure hash function; it was designed to protect against accidental errors, not malicious attacks. Most credit card numbers and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from mistyped or otherwise incorrect numbers.

The check digit is computed as follows:

Assume an example of an account number 1789372997 (just the "payload", check digit not yet included):

The sum of the resulting digits is 56.

The check digit is equal to .

This makes the full account number read 17893729974.

The Luhn algorithm will detect all single-digit errors, as well as almost all transpositions of adjacent digits. It will not, however, detect transposition of the two-digit sequence 09 to 90 (or vice versa). It will detect most of the possible twin errors (it will not detect 2255, 3366 or 4477).

See all
User Avatar
No comments yet.