Generate a hash of the argument string as ASCII codes
Represent each character as a 3×3 boolean matrix
Represent the Position Identification Square (PIS) as four numbers
Arrange the ASCII and PIS numbers as a 2-D QR code
Map each number to a 3×3 boolean matrix
The result will be an 18×18 boolean matrix for a URL of ≤20 chars; a 36×36 matrix for a URL of 25-132 chars.
Hashing the URL
To encode a string to a QR code, first, you need to hash the string and convert it to a fixed-length string. For the smaller QR version (input string less than or equal to 20) you need to hash the string to 24 characters and for the larger version (input string greater than 20) you need to hash the string to 132 characters. Follow the steps below to get the hashed string.
The ASCII value of the first character of the hashed string = Length of the input string + 50 (which is used for decoding purposes).
Assume the length of the string is L. Then, the next L characters of the hashed string should be the characters of the input string. To fill the remaining characters (this part of string is used for error detection), add 1 to the ASCII values of characters in the input string and append them to the string until you reach the desired length. Do this by incrementing the number you are adding by 1 in each round until all the required number of characters is obtained. Then reverse the error detection part of the hashed string.
Observe the given example:
Input string: ABCDEFGH
First character = 50 + 8
58 65 66 67 68 69 70 71 72 73 72 71 70 69 68 67 73 72 71 70 69 68 67 66
: A B C D E F G H I H G F E D C I H G F E D C B
None of this seems hard in q. The hash starts:
The rump is for error correction and is slightly more interesting.