Will the QR code run out?

2022-10-31 | 900 view
With the full popularity of smart phones, two-dimensional code has also penetrated into our life, we have to use mobile phones to scan the two-dimensional code in many places, for example, adding friends, mobile phone payment, open the website.

 

With the full popularity of smart phones, two-dimensional code has also penetrated into our life, we have to use mobile phones to scan the two-dimensional code in many places, for example, adding friends, mobile phone payment, open the website. The world uses up to 10 billion QR codes every day, so will the QR code run out? What if you run out of QR codes?

About this problem, let's take a look at the predecessor of two-dimensional code: one-dimensional code, which is commonly known as bar code.

Barcodes are a series of black stripes of varying thickness and white space arranged according to coding rules, which hide information about the item. When the scanner's light hits the bar code, the black part absorbs the light and the white part reflects it. When the scanner picks up the reflected light, it can parse the information on the bar code.

Barcodes are one-dimensional, with no information in the length direction and all data in the width direction. If the item has a lot of information, the bar code can become very long, which makes it difficult to use. And barcodes can only encode letters, numbers and symbols, not complex information like Chinese characters.

On the basis of the bar code, people invented the two-dimensional code. Since information can be recorded in both directions, QR codes can carry a wealth of data and Chinese characters can be encoded. Therefore, two-dimensional code is very widely used.

So, how is the information written into the two-dimensional code? What do the black and white dots on the QR code represent?

Whether it's a phone or a computer, their processors can only recognize zeros and ones. In order for the machine to recognize the information, individual numbers, letters, symbols, Chinese characters, etc. need to be encoded one by one, all represented by zeros and ones.

In making a QR code, the information is converted into a specific binary code of zeros and ones, then a white dot for a zero and a black dot for a one, which are arranged according to certain rules. Add three large black blocks for location, and you get the final unique QR code. In addition, the two-dimensional code has fault tolerance mechanism, if the proportion of the two-dimensional code missing or deface is not more than 30%, the two-dimensional code reader can still accurately read the information.

So, how many QR codes are there? Will the QR code run out?

In the current QR code, the smallest matrix size is 21×21, containing a total of 441‬ points, each of which can be 0 or 1, so the total number of changes is 2^441, or 5.6×10^132, equivalent to 5.6 trillion billion... Exascale (total of 1.6 billion). For comparison, the total number of particles in the observable universe is on the order of 10^80. Then exclude error correcting code, positioning code, the number of two-dimensional code can be produced is still a very large number.

Even if the world used 10 billion QR codes every day, it would take an extremely long time to use them up, well beyond the universe's current age (13.8 billion years). The universe from scratch billions of times, every day to use tens of billions of two-dimensional code, still can not run out of two-dimensional code.

Remember that in addition to the 21×21 matrix size, there are dozens of other larger sizes. The largest can be 177×177, which contains 31,329 points. Excluding other codes, this can produce up to 2^ 23,624 QR codes, equivalent to 3.4×10^7111.

There are at least 200 billion galaxies in the observable universe, even if there are tens of thousands of intelligent civilizations in each galaxy, we use the two-dimensional code together as long as the age of the universe, still can not run out of two-dimensional code. So we don't have to worry about running out of QR codes.