How to fake a credit card number ? - 101
If you are thinking - ‘Dude, its a bunch of numbers, can’t i just make my own credit card number?’. Well, then this post is for you.
You see in order to ensure that people don’t game the system, credit card companies have a simple set of rules. ( a checksum )
The Luhn algorithm or the mod-10 algorithm is what you need to beat. Its used to validate a lot of things from credit cards to social security numbers.
Say you have a credit card whose number is 4012-8888-8888-1881. In order to check whether the credit card is a valid one, then we have to do a really simple mathematical operation.
Double every other number and add them. Call this sum - x
Add the rest of the numbers. Call this sum -y
If (x+y) is a multiple of 10, then its a valid card, otherwise its not.
Valid credit card numbers
The last number in a credit card is known as a ‘checksum’ and it plays a vital role.
According to this, only 4012-8888-8888-1881 is a valid card number. not 4012-8888-8888-1882, 4012-8888-8888-1883,4012-8888-8888-1884, 4012-8888-8888-1885 …… 4012-8888-8888-1889.
( because they their sum is not a multiple of 10 )
Of course, although this was good enough algorithm in the 20th century, with high processing power you can do much more than a simple mod 10 test.
Therefore, the present day check sum although is based on this, is packed with much more fascinating mathematics.
( Verhoeff algorithm, Damm algorithm, Luhn mod N algorithm are some good places to start on your quest )