What is Mod 10? Mod 10 is a technique for checking the validity of credit card numbers. You can use this code to check credit card numbers that are entered through a form to your web site. The process only checks to make sure that the credit card number is within a set of numbers which are valid for that particular credit card. It is the same idea as checking to make sure that all email names have a '@'. Checking avoids bad entries in the database, but doesn't mean that the data is good. | ||
Confusion
There is some confusion regarding the name of the "Mod 10" process. I first heard about this a couple of years ago when a client wanted me to write some code that would check the validity of credit card numbers. He called it a "Mod 5" check. I had no idea what that meant and the issue did not arise again within that projects life span. I have noticed a number of people have had a misconception about the name of the check some call it "Mode 10." Others, such as my bank, have not heard of the check. However, the correct name is "Mod 10." The name comes from the PASCAL, MODULA2, and BASIC command called Mod. Mod is the remainder of a division of two numbers. Since the most important step in validating the credit card is dividing the check sum by 10 and check to make sure the remainder is zero, the process was named "Mod 10." Thanks, Wayne Berry Editor | ||
Mod 10 Rules
The rules for a Mod 10 check:
| ||
Download
Nothing special to install, just download the source and add it too your project. You must be linking to MFC for the code to compile. ftp://ftp.15Seconds.com/010197.zip (3K) | ||
Performance
This is not the fastest code. We decided to make that code more readable which compromised it's performance. The first thing to remove to enhance performance is the dependency on CString and MFC. The second thing would be to hard code the mask. Also, please forgive the cast to int trick to find the remainder. ciąg dalszy
|
Licznik = (od 2 stycznia 2001) |