Skip to content
Adam Omar Saleh

AIO CTF 2026 placeholder badge (unofficial)AIO CTF 2026Cryptography

XOr

Repeating-key XOR / known plaintext

Competition
AIO CTF 2026 placeholder badge (unofficial)AIO CTF 2026
Category
CryptographyEasy · estimated
Analysis status
Reproducible
Document
Original PDF

01Challenge analysis

The problem

The supplied chall.py encrypted each character with a short repeating key using ord(flag[i]) XOR ord(key[i % len(key)]). The output began with p{|, while the known flag prefix was AIO{.

02Exploit or recovery path

How I solved it

  1. 01

    I read chall.py and recognized a repeating-key XOR instead of an irreversible hash.

  2. 02

    I XORed the first ciphertext bytes with the known plaintext prefix AIO{. The four known positions gave the repeating key pattern 1, 2, 3, 1.

  3. 03

    I therefore recovered key 123 and applied the identical XOR operation to the full ciphertext.

  4. 04

    The decoded output gave the flag shown below.

03Code evidence

Reproduction

Solver / Reproduction
cipher = r"p{|JJ\Cm^PYVBmQHFVBmWP\PTmF_VVCm[XVWT\lZWJBO"key = '123'flag = ''.join(chr(ord(ch) ^ ord(key[i % len(key)]))               for i, ch in enumerate(cipher))print(flag)

Result

RECOVERED FLAG

AIO{xor_makes_bytes_dance_under_hidden_keys}

Reproducible

Local Verification
The script and ciphertext are preserved in the original CTF_Writeups.txt; no platform acceptance was retained.

Original document

Original PDF

The writeup as I first documented it.