[michaelv.org - cooler than triangles!][michaelv.org - cooler than triangles!]

Magnetic Stripe Reading

Written October 2005

USB magnetic stripe readers are an easy way to read credit cards and other cards with magnetic strips. The three track version of this series is cheaply available on eBay (I paid $25.50, including shipping, for a brand new unit). The stripe reader emulates a keyboard and whenever a card with a magnetic stripe is swiped, the stripe readercard data is "typed" into my computer as if typed on the regular keyboard.

I've written a small program that installs a Windows hook to intercept key data. I configured my stripe reader to prefix all returned data with ASCII code 127 so that it is distinguishable from normal keypresses. My program will detect a card swipe and if the card is a driver's license (following AAMVA format) or a credit/debit card, it will display all the information nicely formatted in a window. You can download this (with source code) here.

The program creates an icon in the system tray. Right clicking the icon exits the program and left clicking shows the information window. When a driver's license is swiped, the program automatically launches a browser window that shows the Google maps satellite photo of the person's house. It's very creepy.