The **Luhn algorithm** or **Luhn formula**, also known as the **Modulus 10 Algorithm **(mod 10), is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers and Canadian Social Insurance Numbers. The algorithm is in the public domain and is in wide use today. It is not intended to be a cryptographically secure hash function and should be encrypted via SSL or PHP Programming methods. It was designed to protect against accidental errors, not malicious attacks. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from collections of random digits.

The formula verifies a number against its included check digit, which is usually appended to a partial account number to generate the full account number. This account number must pass the following PHP Programming evaluation:

- Starting with the rightmost digit (which is the check digit) and moving left, double the value of every second digit. For any digits that thus become 10 or more, add their digits together as if casting out nines. For example, 1111 becomes 2121, while 8763 becomes 7733 (from 2Ã—6=12 â†’ 1+2=3 and 2Ã—8=16 â†’ 1+6=7).
- Add all these digits together. For example, if 1111 becomes 2121, then 2+1+2+1 is 6; and 8763 becomes 7733, so 7+7+3+3 is 20.
- If the total ends in 0 (put another way, if the total modulus 10 is congruent to 0), then the number is valid according to the Luhn formula; else it is not valid. So, 1111 is not valid (as shown above, it comes out to 6), while 8763 is valid (as shown above, it comes out to 20).

By checking the number of digits and pattern checking parts of the number, you can determine which credit card company issued the number.Â Try the following PHP Programming demo of a Modulus 10 Check. By reverse engineering the Modulus 10 calculations, you can easily use PHP Programming to generate credit card numbers that pass the evaluation.

eCommerce web sites that perform simple Mod 10 checks will validate privately generated credit card numbers. Valid credit card umbers can bypass simple client-side Javascript form checks. eCommerce web sites that are unable to connect to third party validation servers may default to an accepted status. The bottom line for eCommerce web sites is to check if the supplied credit card number is authenticated by the credit card company, but majorily to assure that funds exist. Leverage the power of PHP Programming to assure your Mod 10 evaluation is secure, efficient, and fast.

The Luhn algorithm will detect any single-digit error, as well as almost all transpositions of adjacent digits. It will not, however, detect transposition of the two-digit sequence *09* to *90* (or vice versa). Other, more complex check-digit algorithms (such as the Verhoeff algorithm) can detect more transcription errors. The Luhn mod N algorithm is an extension that supports non-numerical strings. Enhance any Mod 10 evaluation with appropriate PHP Programming.

The algorithm appeared in a US Patent for a hand-held, mechanical device for computing the checksum. It was therefore required to be rather simple. The device took the mod 10 sum by mechanical means. The *substitution digits*, that is, the results of the double and reduce procedure, were not produced mechanically. Rather, the digits were marked in their permuted order on the body of the machine.