![](http://d1zlh37f1ep3tj.cloudfront.net/wp/wblob/54592E651337D2/B65/1214EE/_-4N7Zm3HXCPDN6zC-hhUQ/CCfrontEN1.png)
- Luhn algorithm is used to check if it is a valid number.
- The first digit of credit card number represent the category of entity or Issuer Number
- First six digits of a card number indicate the bank that issued the card.
- Digit 7 to last number minus 1 indicate individual account identifier.
- Last number indicate the check digit.
![](https://stephenhaunts.files.wordpress.com/2013/06/cardnumberformat.png?w=625)
![](http://img.wonderhowto.com/img/41/92/63460112625171/0/credit-card-algorithms-work-anatomy-credit-card-numbers.w654.jpg)
Validating Credit Card Number
Step1:Double every alternate digit of account starting second digit from right.
Step2:Add the individual digits comprising the products obtained in step1 and each of unaffected digit in the original number.
Step3:The total obtained in step 2 must be a number ending in zero (30, 30,50 etc.) for the account number to be valied.
![](http://www.codeproject.com/KB/E-commerce/515367/4.png)
![](http://www.moneybluebook.com/imagesvr_ce/mbb/luhn-amex-calculation.jpg)
0 comments: