The generation of qr code details and
QR Code also called QR Code, QR for the Quick Response, is a mobile devices in recent years very popular a kind of coding way, it is better than the traditional Bar Code Bar Code can save more information, can also be said more data types: such as characters, Numbers, Japanese, Chinese, and so on.This two days to learn about qr code image generated by the details, feel this thing is a cryptographic algorithm, in this writing a, this article revealed.For studious people learn.
On the QR Code Specification, can see the
Basic knowledge of
First of all, we say the first 40 a qr code size.The official Version Version.Version 1 is 21 x 21 matrix, Version 2 is 25 x 25 matrix, the size of the Version 3 is 29, each adding a Version, will increase the size of the 4, the formula is: (n - 1) * 4 + 21 highest Version is the Version number (V), 40 (40-1) * 4 + 21 = 177, so the highest is 177 x 177 square.
Here we see a qr code sample:
; The Position Detection Pattern is positioning design, used for
rectangular size mark qr code.The three positioning pattern has a
white border called Separators for Postion Detection Patterns.The
three rather than four means can identify a rectangle.
; Timing is used to locate Patterns.Because of qr code there are 40
kinds of size, size too big after line needs to have a root, or else
could sweep the slanting when scanning.
; Alignment Patterns (including Version2) Version 2 above only the
qr code need to the east, also is to locate.
The functional data
; The Format Information exists in all sizes, used to hold some
; The Version Information above > = Version 7, need to reserve two
pieces of 3 x 6 area to store some Version Information. Data code and error correction code
; In addition to the above those places, the rest of the place to store
the Data Code Data Code and the Error Correction Code Error
Let's say data encoding.QR code to support the following code:
Numeric mode digital coding, from 0 to 9.For encoding digital number is not a multiple of 3, then, the last remaining 1 or 2 digits will be transformed into 4 or 7 bits, the other is 10,12,14 every 3 digit bits, into how much to look at the size of the qr code below (Table 3 shows that there is a Table)
Alphanumeric mode character encoding.Including 0-9, the capital of A to Z (no lowercase), as well as the symbolic $% * + - / : including Spaces.These characters will be mapped to a character index table.As shown below: (the SP is a space, Char is character, the Value is the process of the index Value) coding are the two groups, the characters in the two and then switch to the table below 45 into the system, and then into 11 bits of binary, if finally there is a single, then into 6 bits of binary.And coding mode and the number of characters need according to the different size Version into 9, 11 or 13 binary (Table 3) in the following Table
Byte mode, the Byte code, can be a scale of 0-255 to ISO - 8859-1 characters.Some of the qr code scanner can automatically detect whether the utf-8 encoding.
Kanji mode it is Japanese, and double byte code.Also, can also be used