We posted David Cranor’s Arduino card reader the other day, and today he wrote in with an even better magstripe hack: a way to simulate a card swipe using an iPod an electromagnet. David writes:

When the card is swiped past the card reader, the changing magnetic field of the passing flux reversals induce a current in the reader element, which is then decoded into binary bits, and the original data stored on the magnetic stripe is reconstructed.

So, in order to emulate a particular magnetic stripe, all we need to do is find a way to recreate the pattern of the way its magnetic field changes as it’s being swiped past the reader. How are we going to do this? With an electromagnet!

The final piece of this puzzle is how to control the electromagnet. Well, we’re trying to recreate a particular waveform of current through the solenoid in order to create a particular waveform of magnetism. What’s a common way of storing waveforms and converting them to electric current? Sound files! So, all we have to do is encode the highs and lows representing the desired flux reversal pattern into a .wav file and play it back on an iPod or similar music player through the solenoid.

So between these two howtos, you now know how to read the contents of a magstripe card, encode that data into a wav file, and then simulate a card swipe using that recorded data. For more information on magnetic stripe technology, you should check out “A Day in the Life of a Flux Reversal” by Count Zero, written in 1992 for Phrack #37.

It’d be cool to make a nice looking version of the interface so that you could put all your cards, be they student IDs, bank cards, or gift cards, on your iPhone. My guess, though, is that there’s no chance any supermarket checkout attendant would let that simulated card slide. On the bright side, this aught to be a reminder that a thing you have (magstripe card) isn’t very sufficient as an identification tool unless it’s combined with a thing you know (pin number) or a thing you are (a face that matches the photo on the card).

Previously: Decoding magstrip cards with Arduino