In the last year, we’ve seen QR codes become a regular part of our lives. Combined with mobile internet and new mobile platforms, they’ve become a powerful tool. They’re frequently used for contests, sales tracking, entertainment, transport tickets, loyalty marketing, or simply a company’s business card with its address and related information. They’ve spread quickly thanks to how easily they can be read from a Smartphone and their large storage capacity compared to traditional barcodes. Even the Spanish government’s latest budget was presented via a QR code (it was nothing more than a URL that took you to aeat.es). In this article we’ll cover various aspects of this type of code.

 

 

What is a QR code?

A QR code is what we call a two-dimensional code. It was designed by Toyota for the automotive industry. More recently, the system has become popular in different fields.

In general, a QR code is a matrix of black and white dots that has data encoded in binary. It carries a special marker in three of the square’s four corners so it can be oriented correctly. It’s also protected by an error-correction code. When designing a QR code, two important factors have to be taken into account: density and error correction. Up to 30% of errors can be corrected with the QR error-correction system. For decoding, it uses a DES algorithm (56 bits). The QR code is usually read with a smartphone, which is what interprets that information.

Since the aim of this article isn’t to give a highly technical description, we’ll only highlight the most important parts of QR codes.

QR structure.

Finder pattern: This is simply a pattern that occupies 3 of the 4 corners so the code’s exact orientation and how to interpret the bit string can be determined.

Format information: The format the information is in, whether it’s a URL, plain text, a business card…

Timing pattern: A string of 0s and 1s used to track the alignment of the Finder patterns.

Data: This is, obviously, the raw data.

Alignment pattern: Another extra identifier used to determine the QR code’s orientation.

Version: The version we’re using, which indicates the QR code’s density.

 

Qr-Sozpic

Storage.

The amount of data we can store depends on three factors: the data type (numeric, alphanumeric…), the version (indicates the QR code’s density), and the level of error correction (the higher the error correction, the lower the capacity).

Version or Density

The QR version is directly related to its density and therefore to the amount of data it can store. There are 40 versions, from version 1 sized (21×21) up to version 40, which is sized (177 × 177). The higher the density, the harder it is to read from a distance. Let’s look at an example of the different densities.

 

 

 

Error correction

Error correction is used so that even if the QR code is damaged or hard to see, it can still be read by the scanner. The higher the level (greater data redundancy and more recoverable data), the lower the storage capacity.

These are the levels used to categorize how much data can be recovered.

Data types

The amount of data we can encode in a QR code will also depend on the type of data we’re entering. If we enter only numeric data we can store a larger amount than if we enter alphanumeric data, since the latter has to be encoded with more bits. For example, based on the variables explained above, let’s look at what one of the most common types of QR code would look like, the 4-L (that is, version 4, error correction L[OW]):

This is probably the most common type, since it’s enough to store a web address.

Precautions with QR codes

In recent days, we’ve seen some warnings about QR codes carrying viruses. Well, one thing is certain: no one is going to get infected with a virus by scanning a QR code. In the worst case, QR codes can take you to a website or prompt you to download a “malicious” app, from there, the situation is under your control.

A virus has to be part of an executable file, meaning part of an application that runs on the mobile device. QR codes don’t have data encoded into executables. So it’s worth stressing this point: QR codes cannot be viruses. The last known virus linked to QR codes was in Russia. The QR code linked to the download of an Android app that was able to create SMS messages, which were then sent to a premium-rate number.