Secret Decoder Ring Caesar shift pinned by the known flag prefix

crypto
flag L3m0n{3b56db3a159b883d2371437952be1635}

A 50-point guided beginner lesson: "a cereal-box decoder ring scrambled our flag, spin it back." The ciphertext is S3t0u{3i56ki3h159i883k2371437952il1635}

  • letters shifted, digits and the braces/underscore left alone. Classic Caesar.

Insight

Every flag in this event starts L3m0n{, and the ciphertext starts S3t0u{. ord('S') - ord('L') = 7, so the shift is nailed down from a single known-plaintext comparison - no 26-way brute force needed, though running one anyway is a nice sanity check: shift 7 is the only value in 0..25 that produces the L3m0n{ prefix.

python
1CT = "S3t0u{3i56ki3h159i883k2371437952il1635}"
2
3def caesar(text, n):
4    out = []
5    for ch in text:
6        if ch.isupper():
7            out.append(chr((ord(ch) - 65 - n) % 26 + 65))
8        elif ch.islower():
9            out.append(chr((ord(ch) - 97 - n) % 26 + 97))
10        else:
11            out.append(ch)          # digits, braces, underscore pass through
12    return "".join(out)
13
14shift = (ord(CT[0]) - ord("L")) % 26      # 7
15print(caesar(CT, shift))

Decrypting with shift 7 gives L3m0n{3b56db3a159b883d2371437952be1635} - note that the hex letters inside the braces (a-f) were shifted right along with the rest of the alphabet, so i -> b, k -> d, l -> e need unshifting too, not just the word L3m0n.

Pitfall

Don't assume only the "word" part is enciphered. The hex digits a-f are letters too, and the challenge shifts the entire string uniformly - skip shifting them back and you get a flag that looks plausible but fails format validation.