Mammoth era contactless payment + self-made card reader

Father

Professional
Messages
2,605
Reputation
4
Reaction score
589
Points
113

Magnetic Stripe​

Have you noticed this thing on your map? No? But this is the very detail that makes a rounded rectangle-a payment tool in emoji.

Why were there no magnetic stripes in Russia? They were, but not everywhere. This is mainly due to the fact that bank cards arrived in Russia late, and immediately with a chip. But in the United States, the country of the invention of bank cards, there are still a lot of terminals that do not accept the chip.

How does it work? In simple terms, a magnetic stripe is a data storage device. Same as paper, for example, or a memory chip(not a microprocessor). By the way, paper was also used for payment, even before magnetic strips, for this purpose, using a special imprinter device, they made an imprint of the numbers stamped on the card.

If you are interested in learning about the physical aspects of data storage on the band: bit encoding, checksum, particle magnetization-links to this below.
Here we will consider only 2 and 3 levels of representation.

1. Physical encoding of information
2. Logical encoding
3. Application Level

Assembling a card reader​

Well, yes, and you think everyone has it at home?

You can buy a ready-made small factory device from China, but it costs too much there-from 1000 rubles on sale. To play a couple of times and write an article is a bit expensive, so I'll create my own.

What we'll need:
  1. Something with a magnetic head
  2. Old headphones (wire with minijack)
  3. 2-3 position switch (or you can use your fingers)

    Where there is a magnetic head: devices that work with cassettes, payment terminals.
    But since I don't have any devices that read cassettes at home, the only way out was to buy a payment terminal (even the oldest one will do). The magnetic head rarely fails and you can buy any of the cheapest terminals so that you don't feel sorry to disassemble it. I was able to buy 2 devices at once for only ~600r.

    To assemble, you just need to connect the common wire of the minijack to each of the coils of the magnetic head on one side. And on the second side, connect both audio channels to the common output of the switch, and connect the remaining outputs to the second output of each coil.

    As it turned out for me:
I ate at McDonald's to save $5

I ate at McDonald's to save $5

I connected the 1st and 2nd coils of the magnetic head to the switch, since there is usually nothing on the 3rd track(track).

It is important to remember that 1 track is located at the very top of the map, that is, it is mapped to the lower reel of the reader, and 3 is obtained at the very top.

Software part​

Assembling such a reader is half the battle. We still need to decode the received data somehow. I found only such a program - magstripper and in principle it works.
How to use it (you need java):

You need to connect the reader to the microphone input.

Set this input as the default recording device in the sound settings

Download
and click 2 times on .jar file
Opens the following window:

magstripper

magstripper

Click on the button with the microphone and the green arrow and draw the map (switch on the 2nd track)

waiting for questions why are these banners here

waiting for questions why are these banners here

Magnetic stripe cards in culture​

Task from the game Among Us (2018). You need to swipe with the map, not fast or slow.

Task from the game Among Us (2018). You need to swipe with the map, not fast or slow.

Now the swipe speed is not really important. In all terminals, I spent as much time as I could, and if the terminal was working, everything went well. On a homemade card reader, I also managed to spend quite quickly and the data was read. The only thing you can't do is stop in the middle of reading, then you definitely need to start again.

Analyzing the received data​

Yes, I cut the number to the BIN itself. Briefly about the format of data on the 2nd track of a bank card (translated from Wikipedia):

This format was developed by the Banking Industry (ABA). This track is recorded using a 5-bit scheme (4 data bits + 1 parity), which allows you to record 16 characters, including the numbers 0-9 and 6 characters : ; < = > ?. The choice of 6 punctuation characters may seem strange, but these 6 characters are easily projected onto the ASCII range 0x30-0x3f, which contains exactly 10 numbers and these 6 characters. Data format:
  • Start pointer — one character (usually ';')
  • Account number (PAN) - up to 19 characters. Usually, but not always, it matches the credit card number printed on the card itself.
  • Separator — one character (usually '=')
  • The validity period is four characters in YYYY format.
  • Service code — three digits. The first one means the acceptance rules, the second one means the authorization rules, and the third one means the range of services delivered to the holder. (below)
  • Unpredictable data — required for card authentication
  • End pointer — one character (usually '?')
  • Longitudinal Integrity Control (LRC) — a checksum.

    Service code
    First digit (Rules for accepting the card for use)
  • 1 International use is permitted
  • 2 International use is allowed, a chip is required if supported by the merchant (if the terminal is equipped with a chip reader)
  • 5 National use only, if there is no agreement with a foreign bank.
  • 6 Only national use, if there is no agreement with a foreign bank, a chip is required if supported by the merchant (if the terminal is equipped with a chip reader)
  • 7 Accepted only in the network of partner banks
    Second digit (Payment authorization rules)
  • 0 Normal (Can be offline)
  • 2 Contact the issuing bank via the Internet
  • 4 Contact the issuing bank via the Internet, except for a bilateral agreement between banks

    Third digit (Range of services provided to the holder)
  • 0 Without restrictions, you need to enter a PIN (personal identification number)
  • 1 Unlimited, no PIN required
  • 2 Products and services (you can't take a video clip)
  • 3 Use only at an ATM, you need to enter a PIN
  • 4 Only in stock
  • 5 Products and services (you can not take a video clip), you need to enter a PIN
  • 6 No restrictions, you need to enter a PIN (if supported, optional)
  • 7 Products and services (you can't take a video), you need to enter a PIN (if supported, optional)
Let's try to analyze what we counted from the card.
;5536910000000000=29122013000032100000?

Number: 5536910000000000
Validity period: 2912
Service code: 201
  • International use is allowed, a chip is required if supported by the merchant (if the terminal is equipped with a chip reader)
  • Normally (You can go offline)
  • No restrictions, no PIN required

Checking it out

please money do not sleep

please don't write off any money, mom's card

Almost conclusions​

In 2023, the magnetic stripe is almost gone. And by 2025, the main payment systems have announced their intention to remove them altogether.

Those Habr readers who were adults when I was not yet born, and found magnetic stripes as their direct means of payment, most likely will not take anything out of this article. But those who are younger and don't even know why a magnetic stripe is needed or how to use it may have discovered something new. But stop.

Where is the magnetic stripe used in 202x?

If you take your card right now and spend it in the nearest pyaterochka, then 101% that you will not succeed. The terminal will ask you to insert the card with a chip (service code). And this is done for a reason.

Imagine the situation: you are a small fifth-grader boy whose mother threw off 2000 rubles for lunch after school. You bought a bun and juice and still have 1,900 rubles left. But then the evil uncle comes around the corner and takes the children's card. If this protection measure did not exist, the robber would easily have swiped a magnetic stripe and debited all the money without a pin at the first store. But since the terminal sees that there is a chip on the card, it will not give the fraudster a chance. (Yes, I know about NFC, but there is a threshold of 1000 rubles per operation, but there is no one in the band)

That's how people used to live I want to live the same way​

Where can I get a magnetic stripe card?

Yes, it's still possible. Somewhere they write that visa and mastercard have long banned the issue of cards without a chip, only with a stripe. But what are their rules to us? There is 1 Russian bank that continues to issue gift cards under its own brand to this day. Google: < < gift card with money>> 1 or 2 link - what you are looking for.

My one​

las vegas

las vegas

Service code 121
  • International use is permitted
  • Contact the issuing bank via the Internet
  • No restrictions, no PIN required
But the PIN is still requested 1 time by the terminal, in the McDonalds terminal. (because transactions using a magnetic stripe must be checked by the cashier for matching the signature on the receipt and the back of the card, and since the self - service terminal is a pin)

In general, there are more problems with it, mostly of course the cashier will be surprised and a couple more people in the queue, but when after 3 swipes - nothing, and you have to get apple pay is not quite cool =/

And it also physically wears out, after 20 payments it is already covered in longitudinal scratches.

But this is not the only bank that issues cards without a chip, there are also cards of different MFIs. MasterCard + Golden Crown co-badge. And just on the 3rd band, the golden crown stores its data, which is track 2 with minor differences.

Why do banks continue to issue cards without a chip, because it is not safe? - cheapness of cards without a chip

Cool links​

 
Top