the Luhn algorithm; this is a means of checking a series of
digits to determine if it’s a valid credit card number. Note
that it will only tell us if the string of digits could be a
credit card, not that it actually is one. It’s not secure, and
it’s not meant to be — it’s simply a top-level check.
Figure 6 shows the (redacted) output from the fancy
version of the program. You’ll forgive me for not wanting
to print my credit card numbers!
While testing this version (included in the article
downloads), I swiped my AAA membership card and it is
reported as a VISA. Of course, it’s not, and if there is a
valid VISA card with those same digits it will also include a
security code which helps to prevent unauthorized
So, once again, we’ve breathed new life into an
inexpensive piece of surplus hardware and — I hope —
learned how we can use abort to create programs with
robust error handling.
Until next time, keep spinning and winning with the
; FIGURE 6. Reader display.
March 2013 19