Tuesday, March 20, 2007

I hadn't ever needed to validate a credit card with Javascript until the other day and the client requested that I used Luhn's algorithm so I quickly googled it to find out what exactly this algorithm was!

Here is Wikipedia's article to give you some background and an explanation and then here is a javascript version of the Luhn or Mod 10 algorithm. There are are a few versions out there, here is one, and they all do a very basic test. Obviously they don't actually check that this is a valid card number!

Jon 10:04 AM Permalink

Comments:

Post a Comment