a QR Coded story
Cinzia Bongino Design Academy Eindhoven — March 2019
How to decode a QR Code step by step PAG. 16 PAG. 17 PAG. 18 PAG. 20 PAG.24 PAG. 26 PAG. 28 PAG. 30
What is it? How it works Data Structure Mask Pattern Mode Indicator Character Count Indicator Code Decrypted Solutions
What is a Quick Response Code The QR code is the trademark for a type of matrix (two-dimensional) barcode first designed for the automotive industry in Japan. A QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary, and kanji) to efficiently store data. The size of QR Code is called version. Version of QR Code range from version 1 (21x21 pixels) up to version 40 (177x177 pixels). These versions is defined by how much data that stored in the QR Code. So, the larger the data stored, the larger will be the version.
This story is encoded in a version 2 (25x25pixels).
How it works A QR Code is composed of black and white squares (bits). A QR Code Reader detects the light reflected by the empty spaces in the code (white squares). It generates an analog signal (Volt), which is converted to a digital signal and sent to a processor that will decode it, therefore the viewer can read the message.
0 1 0 1 0 0 0 0 1 LIGHT
ANALOG OUTPUT
DIGITAL INPUT
Message DECODER
Data Structure QR Code always consists of three components: the Data Bits (the information storage, which changes every time), the Function pattern (non-data elements), Format & Version Information Pattern (with the specification used for the code). Function Pattern
Format & Version Information The format patterns contain information about the error tolerance, the QR code version and the data mask pattern.
QUIET ZONE The spacing helps to distinguish the QR Code from its surroundings and separates the alignment markings from the storage data.
TIMING PATTERN
ALIGNMENT MARKINGS They indicate the direction in which the code is printed.
These lines tell how large the data matrix is.
ERROR CORRECTION
MASK PATTERN
Data is stored in letters or digits that are eight bits long (one byte). There are four levels of error correction: The higher the level, the less storage capacity.
When encoding a QR code, there are eight mask patterns that you can use to change the outputted matrix. Each mask pattern changes the bits according to the coordinate in the QR matrix.
Mask Pattern The information is encoded in a QR code through a mask pattern. The masking is defined on a grid that is repeated as necessary to cover the whole symbol. Modules corresponding to the dark areas of the mask are inverted. This means that everytime the mask covers a black square (1), it becomes white (0) and vice versa. There exist 8 conditions of masking. 0
1 000
2 001
3 010
011
(row + column) mod 2 == 0
(row) mod 2 == 0
(column) mod 3 == 0
(row + column) mod 3 == 0
4
5
6
7
100
(floor (row/2) + floor (column/3)) mod 2 == 0
101
((row * column) mod 2) + ((row * column) mod 3) == 0
110
((row * column) mod 2 +(row * column) mod 3) mod 2 == 0
111
( ((row + column) mod 2) + ((row * column) mod 3)) ) mod 2 == 0
The Mask must never cover the Timing Pattern.
Mode Indicator The general structure of a QR can be detect thanks to the position of four squares in the bottom-right corner. These bits tell the encoding mode (Numeric, Alphanumeric, Binary or Kanji) used for the bits that come after it, and the length of the payload. 0
0
0
1
0
0
1
0
0
1
0
0
1
0
0
0
Numeric Mode /3bit 0-9 Alphanumeric /8bit 0-9, A-Z, $%*+ Binary Mode /8bit Unicode UTF-8 Kanji /13 bit multi byte character
This QR Code story is encoded with the Alphanumeric Mode.
Character Count Indicator In the Alphanumeric Mode one byte can contain one letter, one number or one sign. The first block of bits above the mode indicator represents the lenght of the byte (8 bit). Immediatly after it starts the sequence of byte with the letters of the message. The sum of the black bits give the code of the 8-bit ASCII character. 1
2
4
8
16 32 4
8
16 32
1
2
64 128
64 128
1
2 8
64 128
1
2
4
16 32
4
8
16 32
4
8
16 32
64 128
1
2
64 128
1
2
64 128
4
8
16 32
4
8
16 32
1
2
64 128
4 + 16 + 64 = 84 = T
8 + 32 + 64 = 104 = h
1 +4 + 32 + 64 = 101 = e
LENGHT
Code Decrypted So here you can finally read the message of the QR Code: remember to move the blocks skipping the position of the function patterns (timing and aligning marks). There aren’t any data in these bits. The message will end with a random number. The rest of the QR code that doesn’t contain information is filled with random bits.
128
64 128
1
2
4
8
32
8
16 32 64
4
2
1 128
1
4
2 16
16
1
32 64 16 32
8
2
8
16 64 128
8
4
4
2
4
32 64
2
8 1
128
1
16 32 128
64 128 1
32 64
2
4
16
4
8
16
2
8
32 64 128
1
o e
u Space
j
h
a
h
f
T
l
e
o
t
m ce
z
d
Space
e
p
Spa
7
v
Space
g
y
r
Space
o
e Space
d
x
Solutions
I am Rick, a small bit l
i
t
Space
R a
i
t
l
a e
a
Space
l t Space
I
i
w
a
f d
r
a
n
I
a n
t
y
Space
w Space
e
p
Space
i
Space
l
Space
b
h
f
Space
Space
o
t
Space
14
n
e
14
I
o
h
e
m
I want a friend to play with
e
r
c
s
14
I feel a bit alone here
k
Space
m
a
,
Space
a
b
Space
Space
l
e
i
Space
I meet other seven lonely bits
Together we can form a byte o
e
t
e
o I
e
s
Space
r
n
T
e
y
t
u
d
e
o e
r
t
n
J
r
e
a
o w
w b y
t Space
w
14
s
Space
r
Space
Space Space
u
a
c
t
Space
m
t
h
Space
i
b b
a
Space
s
o
i
Space
e
e
But five bytes write a word
t e
Space
a
e
g
r
b
Space
Just one byte writes a number r
n
Space
n
t
y
t
e
240
e
w
Space
e
o
m Space
h
n
l
m
Space
Space y
14
v
l
f
r
Space
b
129
e
Space
i
s
Space
n
t
u
f
B
e s i e
t
v
Together we can be everything
e
o
g
a
n
w l
e
n
e
g e
t
Space
t
Space
d
Space
14
e
240
a
e
w o
i
e
v
e
r
w
t r h c
e
o
t
T
r
e
T
h
e
t
r h
r y
c
Space
o
Space
e
Space
r
g Space
Together we create one world
e
is a children’s book for nerdy kids. This story is encrypted in nine QR Codes: step by step, you will learn how to decode it by hand. Since every QR Code is made of bits, the tale is a metaphor of co-creation: If you want to go fast, go alone, but if you want to go far, go together.