This section is dedicated to section 8.5 in the specification.
This is the hardest part in my opinion, I will try to make it as clear as possible. QRCodes use a mechanism called CRC it basically takes the data and computes redundancy from it. Depending on how we compute it, we get bigger data. This is why we can have different L/M/Q/H quality (respectively 7%, 15%, 25% and 30%). Computing said redundancy allows for a part of the QRCode to be hidden / illegible and still be decodable. When adding an image on a QRCode, we make use of it's redundancy already.
Thanks to the previous step, we have a buffer data. We want to compute redundancy for our buffer. The idea is to use polynomial division. I summarized information on blocks here. Each Version / ECL gives a different denominator for our polynomial division.
We will go through our buffer by block (groups) and compute for every block the CRC using polynomial division. This polynomial division uses Galois Field (256), which I explain more below.
This following steps are mandatory to begin our divisions.
• Retrieve the generator polynomial, according to Version and ECL. • Split the data buffer (from previous step) in group 1 and then group 2. (You will need information on blocks).
• Apply division by generator polynomial, on each subgroup.
We Will go back and forth using alpha notation and normal notation. You can find the conversion table in the table section. The following example is using the first array from the first groupe as data buffer and 2 as polynomial number. But feel free to try different values (shorter in the beginning).
Each step is explained, don't hesitate to click on the [+] to see more
We have as a final result [204, 158, 218, 240, 157, 103, 216, 32, 194, 90, 54, 72, 65, 182, 36, 123, 73, 111, 109, 66, 17, 128]
Recap: We had a single byte buffer. We splitted it into sub-buffers (groups). Each group had it's CRC computed. We now have 2 buffers for group n°1 and 2 buffers for group n°2. We have one CRC for each group.