Challenge: All’s Fair in Love and CTFs · CTF: DalCTF 2026 · Category: Crypto · Difficulty: Easy
TL;DR
The challenge title is the whole hint. “All’s Fair” → Playfair cipher. The image is the standard 5×5 Playfair key square (a Polybius grid with the even columns blanked out as a visual nudge), and the ciphertext decrypts to a cheeky little message about what we’d all do for a flag.
| |
The Challenge
We’re handed two artifacts:
Ciphertext.txt— a single line of uppercase letters:1CLDYIKMHILSUKCLQBFRequired_Challenge_Image.png— a grid of letters with some conspicuous gaps:1 2 3 4 5 6 7 8 9 10 11┌───┬───┬───┐ │ A │ C │ E │ ├───┼───┼───┤ │ F │ H │ K │ ├───┼───┼───┤ │ L │ N │ P │ ├───┼───┼───┤ │ Q │ S │ U │ ├───┼───┼───┤ │ V │ X │ │ └───┴───┴───┘
Plus the title — “All’s Fair in Love and CTFs” — which, in classic CTF tradition, is doing a lot of heavy lifting.
Step 1 — Read the Title Like a Crook
CTF authors love to hide the cipher name in plain sight. “All’s Fair” is a near-shameless pointer to the Playfair cipher, a digraph substitution cipher invented by Charles Wheatstone in 1854 (and popularized by Lord Playfair, hence the name). It encrypts pairs of letters using a 5×5 key square — exactly the kind of thing a grid-shaped image is begging us to use.
Two quick sanity checks that this is Playfair:
- The ciphertext length is even.
CLDYIKMHILSUKCLQBFis 18 characters — and Playfair always operates on an even number of letters (digraphs). ✅ - No
J. Playfair famously mergesIandJinto one cell. There’s noJin the ciphertext or in the grid. ✅
So far, so Playfair.
Step 2 — Reconstruct the Key Square
Here’s the fun part. The image looks like it only has three columns, but look at the letters:
| |
Those are the odd columns of the standard Polybius / Playfair square with the even columns erased.
Fill the gaps back in and you get the textbook unkeyed square (with I/J sharing a cell):
| |
In other words: no keyword at all — it’s just the plain alphabet (minus J) laid into the grid.
The “missing columns” in the image are a stylistic flourish to make you recognize the Polybius
layout rather than a separate puzzle.
Let’s assign coordinates (row, col), 0-indexed, which we’ll need for the decryption rules:
| col0 | col1 | col2 | col3 | col4 | |
|---|---|---|---|---|---|
| row0 | A | B | C | D | E |
| row1 | F | G | H | I/J | K |
| row2 | L | M | N | O | P |
| row3 | Q | R | S | T | U |
| row4 | V | W | X | Y | Z |
Step 3 — Playfair Decryption Rules
Playfair works on digraphs (letter pairs). To decrypt, you apply the inverse of the encryption rules:
- Same row → replace each letter with the one to its left (wrapping around).
- Same column → replace each letter with the one above it (wrapping around).
- Rectangle (different row and column) → replace each letter with the one in its own row but the other letter’s column (swap the column indices).
Split the ciphertext into pairs:
| |
Now grind through them one at a time.
| Pair | Positions | Rule | Result |
|---|---|---|---|
| CL | C(0,2) L(2,0) | rectangle → swap columns | A(0,0) N(2,2) → AN |
| DY | D(0,3) Y(4,3) | same column → shift up | Y(4,3) T(3,3) → YT |
| IK | I(1,3) K(1,4) | same row → shift left | H(1,2) I(1,3) → HI |
| MH | M(2,1) H(1,2) | rectangle → swap columns | N(2,2) G(1,1) → NG |
| IL | I(1,3) L(2,0) | rectangle → swap columns | F(1,0) O(2,3) → FO |
| SU | S(3,2) U(3,4) | same row → shift left | R(3,1) T(3,3) → RT |
| KC | K(1,4) C(0,2) | rectangle → swap columns | H(1,2) E(0,4) → HE |
| LQ | L(2,0) Q(3,0) | same column → shift up | F(1,0) L(2,0) → FL |
| BF | B(0,1) F(1,0) | rectangle → swap columns | A(0,0) G(1,1) → AG |
Reading the results straight across:
| |
Smush them together:
| |
ANYTHING FOR THE FLAG 🏴
Which, frankly, is the most honest sentence ever embedded in a crypto challenge.
Step 4 — Verify It Programmatically
Hand-decryption is error-prone, so here’s a tiny Python script that reproduces the whole thing:
| |
| |
✅ Confirmed.
The Flag
The prompt told us to wrap the result in dalctf{}:
| |
(Double-check casing/underscore conventions against the event rules — some scoreboards want
dalctf{anythingfortheflag} or a different separator. The recovered plaintext is
ANYTHINGFORTHEFLAG either way.)
Lessons Learned
- The title is a hint. “All’s Fair” = Playfair. Authors plant the cipher name in the flavor text constantly — read it before you reach for the heavy machinery.
- Even length + no
J= think Playfair. Two cheap structural tells that narrow the search space instantly. - A grid image is usually a key square. When a crypto challenge ships a 5×5-ish grid, it’s almost always a Polybius/Playfair/ADFGVX-family square. Here the blanked columns were a recognition cue for the unkeyed standard square, not a second layer.
- Verify by hand once, then script it. Hand-tracing teaches you the rules; the script proves you didn’t fat-finger a coordinate.
All’s fair in love and CTFs — and apparently we’ll do anything for the flag. 🚩