What CCVerf is:
- CCVerf is a ANSI C function that checks the mathamatical accuracy of major credit card numbers.
What CCVerf does:
- Check the mathematical accuracy of the card number against the MOD10 algorithm.
- Check if the card number fits the format for the brand of the credit card. (i.e. Visa, Master Card, American Express and Discover)
What CCVerf does not do:
- Check the actual validly of a card number with a bank.
- Check the balance available on the card number in question.
- Check the expiration date of the card number in question.
Why CCVerf is useful:
- Reduce verification costs related to per verification costs, or related connection costs.
- Provide a simple method for off-line verification.
- Reduce customer wait time while credit card numbers are checked versus the credit card network, just to get a response that the card number is invalid.
- Is just an interesting study in basic security and structure methods.
What CCVerf accepts at its arguments (inputs):
- A string, which is accessed via pointer, which contains the card number in question. This string may contain extraneous non numerical characters, that CCVerf will ignore.
A integer between one and four, which corresponds to the card type, as
stated by the chart below:
Integer Input Corresponding Card Type 1 - Visa 2 - Master Card 3 - American Express/Diner's Club 4 - Discover
How CCVerf checks the credit card number:
- First, CCVerf strips out all the non numeric characters and checks the number of digits. If number of digits isn't 13, 15, or 16 it rejects the card.
- Second, CCVerf checks the length of the number versus the type. Visa cards numbers must be 13 or 16 digits. American Express card numbers must be 15 digits. Master Card and Discover card numbers must be 16 digits.
- Third, CCVerf checks the first digit of the card number versus the type. American Express card numbers must start with '3'. Visa card numbers must start with '4'. Master Card numbers must start with '5'. Discover card numbers must start with '6'.
- Finally, CCVerf checks the card number versus the MOD10 algorithm. The MOD10 algorithm works by utilizing a single digit doubling system on every other digit starting on the first digit on sixteen digit cards, and on the second digit on thirteen and fifteen digit cards. [i.e. five doubles into one. (5x2 = 10, 1+0=1) Eight doubles into seven. (8x2=16, 1+6=7) Four doubles into eight. (4x2=8, 0+8=8)] Next, the MOD10 algorithm adds the resulting doubled digits together and verifies the result is divisible by ten.
An example of how CCVerf checks the credit card number:
The string "4791-0600-2310-2329" and the integer '1' is passed to CCVerf. CCVerf starts by pulling all of the numerical digits out of the string and placing them in a array, represented by following table:
Where to get CCVerf:
- CCVerf is available from my website at http://www.inmff.net/ccverf/ccverf.tar.gz [10k]. To my knowledge this is the only place to obtain CCVerf.
- CCVerf is released under the GNU Lesser General Public License.
How to contact CCVerf's author:
- Nicholas Barnard may be contacted via his website form.