PINK CTFMisc
Bayrisches Theater
The file is 3,964 blue and white squares (🟦 = 1, ⬜ = 0) split into 62 lines of random length.
- Competition
PINK CTF
- Category
- MiscMedium · estimated
- Source status
- Source-documented · not platform-verified
- Document
- PDF edition2 min read
TL;DR
The file is 3,964 blue and white squares (🟦 = 1, ⬜ = 0) split into 62 lines of random length. The line breaks are a decoy. Joined into one stream, the bits form rows of 128 squares, each row ending in a fixed 1111. That leaves a 31 × 31 grid of 4-bit cells. Cells with the value 0000, 0101 or 1010 are dark modules of a QR code, and every other value is light. The QR code holds the address of the Bavarian State Opera (Nationaltheater München) and the year it opened.
01
First look
The file has only three characters: 🟦 (1,709 times), ⬜ (2,255 times) and newline. All 62 lines have lengths that are multiples of 4 (28 to 92 squares), so the 4-square nibble is clearly a unit. Read as nibbles (🟦 = 1), three values are far more common than the rest:
| Nibble | Count |
|---|---|
0000 | 147 |
0101 | 143 |
1010 | 136 |
| any other value | 30 to 60 each |
Lines don't repeat or share prefixes, and decoding them as Morse code, big integers or a bitmap font gives nothing.
02
The line breaks are a decoy
Join every line into one bit stream and split it into bytes. The high nibble is never F, but the low nibble is F 30 times. Since the chance of that happening at random is about 2⁻³⁰, the stream must have structure that ignores the line breaks.
Listing where the 1111 nibbles sit settles it:
positions: 31, 63, 95, 127, ..., 959gaps: 32, 32, 32, ...1111 appears only at every 32nd nibble. The file is really 128-square rows, each ending in four blue squares. 3,964 = 31 × 128 − 4, so there are 31 rows and the last terminator was cut off.

03
A 31 × 31 grid
Once the terminator is dropped, each row holds 31 nibbles, which gives a square 31 × 31 grid of 4-bit cells using only 15 values. Printed in hex, the first and last rows contain no 0, 5 or a at all, while the other rows are full of them. Marking those three values as #:
................................#######.#.#.#..##..#..#######..#.....#.###.#.##......#.....#..#.###.#..##..###....#.#.###.#..#.###.#.##.#....#..##.#.###.#..#.###.#..#.#.#....#...#.###.#..#.....#..##.#.#..###..#.....#..#######.#.#.#.#.#.#.#.#######..........###.###..####............Those are QR finder patterns: a version-3 (29 × 29) QR code with a one-cell border. The values 0000, 0101 and 1010 (all white, or the blue/white lozenge pattern of the Bavarian flag) are dark modules, and the other 12 values are random light filler.
04
Decoding
Files
grid.pyjoins the stream and builds the 31 × 32 grid, and tests box-drawing bit orders (a dead end).solve.pyrenders the QR code and decodes it.
Flag
Flag
PINK{M4x_J053ph_P14tz_2_1818}
Source-documented · not platform-verified

