Ever credit card is unique. No matter the institution that made it. Credit cards are all unique because of the 16-digit number printed on the front part of the card. These numbers are not randomly generated. The institution has a unique formula for generating these credit card numbers. Today, I am going to show you Generate Valid Credit Card Number using the MOD10 Algorithm or Luhn Algorithm. The formula is called Mod10 of modulus 10 because its part of the checksum algorithm used by almost every financial card you can find, such as Rewards cards; even the simple game cards are using the mod10 algorithm.
Table of Contents
Major Identity Identifier (MII):
The first digit of a credit card number is generally an identifier of the significant and general industry or category the credit card belongs to. The following are the principal industry identifiers:
- Airlines: 1 and 2
- Banking and other financial institutions: 4 and 5
- Travel and entertainment: 3
- Petroleum: 7
- Banking and merchandise: 6
- National assignment: 9
- Telecommunication and health care: 8
Bank Identification Number (BIN):
The next important element that you need to know to understand the logic behind the generation of a credit card number is the issuer identification number. The Bank identification number is the first six digits of your credit card number. This identification number will help institutions understand who the issuer is because it is unique for each agency. For example, the IIM for Visa card is different from Mastercard
Apart from the first 6 digits, the following 9 digits generally are representative of the account number of the bank or the financial organization. It’s not the bank account number of an individual but merely an additional identification number for that particular credit card. These are two separate elements on one credit card.
The modulo-10 Algorithm or Luhn Algorithm
This algorithm has its base in the principles of digital roots and modulo arithmetic. Follow the steps given below:
Step 1: For this method, you must start from the digit to the right, the check digit.
Step 2: Now, you will have to multiply every digit on the exact position by 2.
Step 3: If you find that the resulting number has more than one digit, you will now have to add these digits up to come to a single digit, such as 13: 1+3= 4.
Step 4: Now, add the resulting sum to those digits of the credit card number on the odd position. The number obtained has to be made divisible by 10, so you need to find now the number that will make the last number divisible by 109. For example, if the sum comes to 68, you will have to add 2 to make it divisible by 2, so the number you are looking for is 2.
This process is explained with an example below:
The last digit in the credit card number is called the check digit. This process is made using mathematical logic. The steps are given below:
Step 1: Let us consider a card that ahs a credit card number of 2354671390554760.
Step 2: Let’s now consider only the first 15 digits of the card, 235467139055476.0.
Step 3: Now, we will consider the first number and then view every second number. After this, we will multiply the selected number into 2, as follow:
Step 4: Now, sum up all the digits if the product is a two-digit number. Then, 10 would be 1+0 =1
It will provide us with a series of single-digit number such as 4 1 3 2 9 1 8 3
Step 5: Now, we will have to sum up all these single digits and the numbers left from the card:
4+1+3+2+9+1+8+3+3+4+7+3+0+5+7 = 60
Now find what number needs to be added to make this number divisible by 10. In this case, it will be 0 as 60 is already divisible by 109. So this last digit of the card is 0.
Take a look at this image:
And that how you can Generate Valid Credit Card Number, It may be too complicated at first because it is! A scientist discovered this process. Named Hans Peter Luhn and his a computer scientist. No wonder this formula has been used by millions of financial cards worldwide. Because it is secure and safe!