IBM Check

1 post / 0 new
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
IBM Check

As with the LUND formula if anyone can try this out and let me know what it works for that would be great.  I can confirm that it worked for my Mastercard, my Canadian debit card and my American Express card.

This function will return a 1 if the identification number adhere to the IBMCheck else it will return 0 if it is false.

The "IBM check", which is used by MasterCard, VISA, and most other credit card companies (including the new Hudson's Bay Company cards, but not the older ones), is an even/odd weighted code. The digits in the even positions (numbering from the right) are multiplied by 2, then reduced to a single digit (if > 9) by "casting out nines" (subtracting 9, which is equivalent to adding the digits). All digits are then summed and a check digit added to make the result evenly divisible by 10.

This scheme catches all single errors and most adjacent transpositions, but not jump transpositions (such as 553 becoming 355) or 09 becoming 90.

http://www.augustana.ab.ca/~mohrj/algorithms/checkdigit.html