A Pic is Worth a 1000 Words.

By AgrawalKrish

What's in the Numbers ?

Was always curious to know what's logic behind the credit card digits. Here is what I got:

How Credit Card Numbers Are Generated / Validated: Most credit card numbers are validated using an algorithm called the "Luhn check"; That doubles the odd digits and does a sum to see if the number is divisible by 10. It involves a check digit as the last digit.

Any 16 random numbers (16th digit as "x" a Check digit) starting with a 3(American Express), 4(Visa), 5(Master Card) or 6(Discover) as first digit can be a Credit Card#. To have a valid card#, Double every other number. If doubling a number results in a two digit number, add those digits together to produce a single digit number. Replace the odd digits with the new ones just created. You should now have 15 numbers consisting of all the new numbers and the original even numbers. Add up all 15 digits. Manipulate the check digit so that the sum is divisible by 10. Replace the last digit of the original random string with the new manipulated check digit.

e.g.
.4.....9.....9.....0.....2.....7.....3.....9.....8.....7.....1.....2.....3.....2.....7.....x
(8).......(1+8)........(2).........(6)........(1+6).......(2).........(6).......(1+4)
(8)+9+(1+8)+0+(2)+7+(6)+9+(1+6)+7+(2)+2+(6)+2+(1+4)+x
81+x

* To make the sum divisible by 10, we set the check digit to 9, making the full Card number 4990 2739 8712 3279.

Comments
Sign in or get an account to comment.