I am developing a Java toolkit for checking and working with credit cards. So far, I support:
LUHN Confirmation.
Checking the date (simple completion).
Checking the code code length (CVV, CVC, CID) based on the brand (Visa, MasterCard, etc.).
Check credit card length (based on brand).
Check BIN / IIN (in relation to the database of valid numbers).
Hiding numbers (425010 * * * * * * 1234)
To make the tool a little more complete, I would like to create a random number generator for credit cards based on different brands of cards. This functionality (hopefully) will make my test cases more reliable.
Basically, I would like to be able to generate numbers that:
For valid BIN / IIN card numbers, I am going to find a random BIN / IIN number from the database (based on the brand, of course), and then add the remaining digits using Random . Obviously, this would be invalid most of the time, and I would have to increase one of the digits until it passes the LUHN check.
I can't seem to think of a better way. Maybe someone can suggest something a little smarter ...?
Looking forward to your suggestions! Thanks in advance!:)
carlspring
source share