Skip to content

Java Credit Card Checksum Package

While doing some research I discovered the Luhn algorithm and its various applications. For those of you who don’t know, the Luhn algorithm is used in the verification of various number id’s. For example, credit card companies use the Luhn algorithm on all their credit cards. If a credit card can not pass the Luhn algorithm, then it can not be issued. This is done to prevent any random string of digits from being a valid credit card number.

Just because a credit card can pass the Luhn algorithm does not mean that it is an active card. Merely, it means that the card could have been issued. The Luhn algorithm should only be used as a preliminary verification.

I wrote the Credit Card Checksum Package to enable Java to verify credit cards with the Luhn algorithm. I also included credit card issuer identification methods in this package. These methods can tell from which of the four major credit card companies a card was issued from based on prefix(es) and digit length. Methods to generate vendor specific credit card numbers that will pass the Luhn algorithm are also included. Don’t try to use these numbers, they wont work.

The Credit Card Checksum Package is released under the GPL Version 3. The source code can be found inside the jar file.

Download: Credit Card Checksum Package