Welcome to my world

Here is my domain for splurging my ruminations on the STEM fields. Most of the stuff I discuss and research on this site is way beyond what we learn at school and what I am conventionally taught, so there may well be errors in my information or maths - please do not viciously troll the page with corrections, although constructive and useful criticism is of course welcome :)

Sunday 13 December 2015

GCHQ's Christmas puzzle and cryptography

WARNING
This post will contain some spoilers for the puzzle, although I will remain fairly vague - if you are trying to solve all 5 levels without any help from other solvers (indeed like I am trying to do), close this page now. To be honest though, this website is so obscure that nobody will read this until long after the contest has passed! I was very disappointed to find that there is a public Reddit community solving this puzzle by crowdsourcing, not because it is strictly cheating (I think it is an efficient and smart way to tackle the problem) but because I cannot easily conduct research on the cryptic puzzles without stumbling upon other people's solutions, ruining the fun of the challenge. However, trying my best to refer only generally to my current solutions, I must continue writing since this intelligent series of tasks has got me so excited and gripped!

My progress
So far, I have spent most of my Friday at school solving the first puzzle (the shading grid); then I solved the "not odd one out", "weird semaphore message" and "D, D, P, V, C, C, D," problems from stage 2 without help, and with the combined knowledge of my family completed the stage today. There is no prize for noticing that there is a strong emphasis on cryptography within these puzzles, using obscure systems such as hand-signals, morse code, ASCII, phonetic alphabet and even snooker balls colours, and it is this that has prompted me to write this article this evening.

The first problem
I was particularly excited by this, which was shown to be by a friend at school: using the enigmatic numbers on each row and column, one has to fill in the black squares and hence form a QR code, which will direct the player to the next challenge.

The QR code is a very efficient method for encoding information within an image, as a binary matrix of black and white. Although they appear simple enough as what is effectively a two-dimensional barcode, there was a huge amount of development and engineering that went into their perfection - such information was very useful in starting-off the puzzle. For example, there is always a position-fixing square in three of the four corners of the grid (excluding the bottom right), which pins-down a single rotational orientation of the code, a timing column and a timing row which help the reading device get its bearings on the matrix. The puzzle presented to us by GCHQ takes the form of a version 2 QR code, containing 25x25 bits: in this way we are reminded that this is only a beginner task, since the version 40 QR code can hold over a thousand ASCII characters and is 177x177 bits!

Information is not simply stored in rows from left to right, top to bottom, with black as 1 and white as 0 though - to avoid confusing the scanner, which in modern-day usage could be a low-resolution and slightly dirty/moist lens from a low-end smartphone, "masking" has to be employed to avoid the code producing large areas of black or white (which would start to hide the discreteness of the bits), or structures which emulate the tracking squares. Such masking algorithms could include changing which colours represent 1 and 0 depending on their position within the matrix, or entering the data in a non-linear fashion. Such "encoding modes" are represented by a number, which sits somewhere in the QR image.

I was especially intrigued, when sifting through the highly informative but also extremely technical Wikipedia page which forms the source of the past few paragraphs [1], to see how scientists/mathematicians have endeavoured to extend the functionality and capacity of QR codes to store ever more information. For example, coloured QR codes (which with greater bit densities we would regard as "pictures") with 4 or even 8 hues would allow much more data to be stored in the same space, since each colour could represent a longer string of "offs" and "ons" such as 101 and 110. However the difficulties in incorporating such functionality are quite clear: error-correction would be much more complex, since the contrast between adjacent colours would be lessened so scanners would be more easily confused, and version 40 matrices seem out of the question currently because with high bit density a dithering effect (as utilised by 16777216-colour RGB screens) would be observed.

 My suggestion for an improvement to QR codes takes inspiration from recent developments in quantum computing, a field which relies on the existence of superposition to create complex "qubits". The fact that a single unit of information can now take the form of "on", "off" or "on-off" proves very interesting for the cryptography world in my eyes - what if the squares of the QR grid could be fully black, fully white or diagonally half-and-half? This would allow the "separators" (white regions between the tracking squares and the formattable area) and "timing strips" (two standard alternating lines) to stand out more, as well as increasing the potential data-storage power without deviating from binary colours (which cannot be confused in any lighting).

The issue I can see with this concept though is that the half-and-half squares, when viewed from a distance or when very small, would blur into a grey due to diffraction on the lens or the limit of the camera's resolution. However, zooming in too much and making the bits too large would limit the amount of information which could be captured in one snapshot! Therefore there must be an optimum bit size between these two extremes, which would maximise storage on the QR code. Without a thorough investigation it would be a sensible supposition that this optimum, taking into account the technicalities of error-compensation, is reached with a version 40 177x177 grid!

Thank you GCHQ
I feel it is only appropriate to give my sincerest thanks to GCHQ for their brilliant puzzle series this year - I am feeling extremely frustrated on the third level right now, but it sure is better than it being too easy! I really don't want to ruin the puzzle for other players, but I am also extremely proud of the progress my family and I have made through the challenge so far - therefore I will be posting the reasoning behind my answers in a separate article, which cannot be accessed through google and will not show up on my homepage (only through this link).

Sources
[1]   Wikipedia - "QR Code" - here