Solo disponible en BuenasTareas
  • Páginas : 18 (4388 palabras )
  • Descarga(s) : 0
  • Publicado : 5 de junio de 2011
Leer documento completo
Vista previa del texto
• Home
• Archives
• deep thoughts
• frugality
• interesting numbers
• personal finance
• Subscribe
Money, Matter, and More Musings
Musings on Money, Personal Finance, Frugality, Debt, and Other Matters
How To Generate *Valid* Credit Card Numbers
by golbguru on April 12, 2007
[pic][pic]What do the credit card numbers mean and how are they generated? I need tostart with a disclaimer: Do not use any credit card numbers, except your own, to buy things off internet. It’s wrong and it’s illegal. The purpose of this post is *not* to create fraudulent workable card numbers. It is to explain the math and the science behind those numbers that most of us see day in and day out; and hence this post should be viewed from a purely academic perspective.
Typicalcredit card anatomy
Before we understand how credit card numbers are generated, here is a brief explanation of what a typical credit card number means.
• Out of the 16 numbers on a typical credit card, the set of first 6 digits is known as the issuer identifier number (read this for details), and the last digit is known as the “check digit” which is generated in such a way as tosatisfy a certain condition (the Luhn or Mod 10 check). “Luhn check” is explained later in this post. The term sounds intimidating, but it’s really a very simple (and elegant) concept.
• Taking away the 6 identifier digits and 1 check digit leaves us with 9 digits in the middle that form the “account number”.
• Now, there are 10 possible numbers (from 0 to 9) that can be arranged in these 9places. This gives rise to 109 combinations, that is, 1 billion possible account numbers (per issuer identifier).
• With each account number, there is always an unique check digit associated (for a given issuer identifier and an account number, there cannot be more than one correct check digit)
• Amex issues credit cards with15 digits. The account numbers in this case are 8 digit long.What is the “Luhn” or “Mod 10″ check?
In 1954, Hans Luhn of IBM proposed an algorithm to be used as a validity criterion for a given set of numbers. Almost all credit card numbers are generated following this validity criterion…also called as the Luhn check or the Mod 10 check. It goes without saying that the Luhn check is also used to verify a given existing card number. If a credit card numberdoes not satisfy this check, it is not a valid number. For a 16 digit credit card number, the Luhn check can be described as follows:
1. Starting with the check digit, double the value of every second digit (never double the check digit). For example, in a 16 digit credit card number, double the 15th, 13th, 11th, 9th…digits (digits in odd places). In all, you will need to double eight digits.2. If doubling of a number results in a two digit number, add up the digits to get a single digit number. This will result in eight single digit numbers.
3. Now, replace the digits in the odd places (in the original credit card number) with these new single digit numbers to get a new 16 digit number.
4. Add up all the digits in this new number. If the final total is perfectly divisibleby 10, then the credit card number is valid (Luhn check is satisfied), else it is invalid.
When credit card numbers are generated, the same steps are followed with one minor change. First, the issuer identifier and account numbers are assigned (issuer numbers are fixed for a given financial institution, whereas the account numbers are randomly allocated - I think). Then, the check digit is assumedto be some variable, say X. After this, the above steps are followed, and during the last step, X is chosen in such a way that it satisfies the Luhn check.
This part is a bit confusing and takes some time to understand. However, don’t get stuck here…continue reading through the examples below and you will figure out what this is all about.
Credit card numbers valid or invalid?
Have you ever...
tracking img