## Overview[1]#

Luhn Algorithm is the algorithm used to arrive at the proper check digit on most Bank Card Numbers

Luhn Algorithm, named after IBM scientist Hans Peter Luhn (1896-1964), who was awarded US Patent 2950048 ("Computer for Verifying Numbers") for the technique in 1960. For details about Luhn's life, see:

Thanks to Aleksandar Janicijevic for directing me to information about H.P. Luhn.

The most succinct description of the Luhn algorithm I have found comes from the hacker publication phrack 47-8: "For a card with an even number of digits, double every odd numbered digit and subtract 9 if the product is greater than 9. Add up all the even digits as well as the doubled-odd digits, and the result must be a multiple of 10 or it's not a valid card. If the card has an odd number of digits, perform the same addition doubling the even numbered digits instead."

The bit about even and odd is a little confusing. The main point is that you don't want to double the check digit, and this can easily be done by starting with the check digit, going backwards, and doubling every other digit. See the source code below for details.

There might be more information for this subject on one of the following:

Only authorized users are allowed to upload new attachments.
« This page (revision-3) was last changed on 10-Jan-2017 10:59 by jim
G’day (anonymous guest) My Prefs

WikiEtiquette
Find pages
Unused pages
Undefined pages
Page Index
News

### Donations#

If you like Ldapwiki, please consider a donation.

 Active Sessions 118 Uptime 9d, 8h 59m 57s Number of pages 12882

JSPWiki v2.10.1