Q R You?
- 2 hours ago
- 5 min read
When we hear music, there’s usually a go-to association, which can say a lot about the listener.
Take, for example, Wagner’s famous Ride of the Valkyries, from Der Ring des Nibelungen (The Ring of the Nibelung). While I have heard it many times (in isolation, as I have never actually listened to a Wagner opera in its entirety), the version that my mind always goes to is the one in What’s Opera, Doc?, with the famous lines: “Kill da wabbit! Kill da wabbit! Kill da wabbit!”
I suspect that many people who recognize the song Who Are You?, will think of the TV series “CSI: Crime Season Investigation”, which used it as the opening theme. Interestingly, the producers of the “CSI franchise” seemed to be big fans of the The Who, since each series used another one of their songs.
I won’t go into the history and influence of the band and its members at present, but I’ve been watching a number of videos about the band recently, including a number of live performances. Aside from learning a bit and increasing my appreciation for the band in general, I had one revelation I found fascinating.
In watching video of The Who’s drummer Keith Moon, I suddenly realized that I was watching the inspiration (or at least one of them) behind Animal, the drummer from Dr Teeth and the Electric Mayhem. I mean... look at them. The still photos are one thing, but watch the videos, and you’ll see that Animal is simply a more restrained version of Moon...


At any rate, that’s how I got from the song Who Are You? to QR Codes.
Over the past few years, we’ve started seeing QR (“quick response”) Codes more and more, on everything from government documents to restaurant menus, from posters to groceries. At their simplest, they are two-dimensional versions of UPC barcodes, which they are rapidly replacing.
I remember when our schools and public libraries began adding bar-codes to all of the books – fifty-odd years ago, this was a huge innovation, and made things a lot easier and quicker. Of course we immediately began taking them for granted, so it’s only now that I learned how cool they actually were – they were designed not only so that they could be scanned either left-to-right or right-to-left, but also had error-correction built into them. Very cool!
But, if they are so good, why would we need to change them?
They simply don’t carry enough data, and what they do carry is numeric only. So, in practice, they are only effective in limited contexts such as books in a library, or products in a store.
And so, in 1994, a two-dimensional version was invented by Masahiro Hara, apparently influenced by the black and white counters on a Go board. In contrast to the one-dimensional barcodes which were scanned by a narrow beam of light, a QR code is detected by a digital image sensor – like the one in your smartphone’s camera.
There are a number of different versions of the formatting used, but I’ll just hit a few of the more common elements. For a detailed walk-through, covering both the history of barcodes and QR codes and the technical processes, see the great video by Veritasium, who actually builds a QR code by hand.
To summarize, though, there are certain elements which are common to all QR codes.
First is the “quiet zone”, which is the space around the code, and must be empty and of uniform colour.
Second, there will be one or more “position squares” – traditionally in the upper right, upper left, and lower left corners. These consist of a black square, surrounding a white square, which then surrounds another black square. They allow the reader to correctly orient the code.
Next comes the “alignment pattern”. Traditionally, this consisted of one smaller square, placed in the bottom right quadrant, but later versions often have several. These are used to rescale the QR code when read from a variety of different distances or angles.
Then, there are several patterns which contain information about the QR code, including the version, the format, and other metadata. Interestingly, this is duplicated, which increases the resiliency of the code, in case there is damage.
The rest of the space is devoted to the data, generally arranged in 2x4 blocks of bits representing each character. This is where the icon comes in.
Wait, what?
At this point, I would note that QR code standards traditionally do not include support for icons at the centre. So, why does it work? Haven’t I damaged the code?
In fact, the “data” section of the QR code contains not only data, but also error-correction elements, which allow the reconstruction of missing or damaged data in many cases. The technique used is called “Reed-Solomon error correction”, and was introduced in 1960s. The mathematical proof is beyond me, but my understanding is that it’s based on interpreting the data and the error-correction codes as components of a single polynomial equation, which essentially “breaks” if the data and error-correction codes are inconsistent. By “correcting” the invalid equation, the original data or error-correction codes can be reconstructed under certain circumstances.
Very cool!
In practice, this means that, depending on the type of coding used, between 7% and 30% of the data bytes can be restored, so the QR code can suffer significant “damage” and still be readable. In the code above, the icon is technically “damage”, but there is enough information for it to be corrected.
At present, the major concern about QR codes is the fact that they are often used to present web addresses, but do not guarantee their validity or security. The malicious use of QR codes is sometimes referred to by the term “quishing”, which I find extremely distasteful – just call it QR code phishing. Whatever you call it, though, we need to be careful when scanning a QR code. Among other examples, fake QR codes on parking meters are seen quite frequently, due to the success of QR codes generally, and many security products do not yet include adequate protections against malicious codes.
In future, we can expect to see a lot more of them, and will probably also see additional features. For example, some QR codes have built-in encryption, and can only be decoded by readers which have a valid key. There are also “three-dimensional” QR codes, which change as they are presented (to prevent simple copy-paste), or use multiple colours to encode more data, or present multiple codes which are combined to form a single value. In principle, I’m sure that four-dimensional codes could be developed as well – the possibilities really are endless.
Cheers!
