picoCTF 2022 | transposition-trial Write-up

Challenge description

Our data got corrupted on the way here. Luckily, nothing got replaced, but every block of 3 got scrambled around! The first word seems to be three letters long, maybe you can use that to recover the rest of the message. Download the corrupted message here.

Category: Cryptography

Solution

Looking at the provided file gives us the encoded message: “heTfl g as iicpCTo{7F4NRP051N5_16_35P3X51N3_VE1A1D3D}B”

Considering that the flag format starts with picoCTF{…, we can deduce that the text spells out: “The flag is picoCTF{…”

In each block of 3 characters (space included), the first letter is moved to the end. For example, “The” becomes “heT”, and so on.

To decode the message, I wrote a quick python script:

ctxt = "heTfl g as iicpCTo{7F4NRP051N5_16_35P3X51N3_VE1A1D3D}B"
ptxt = ""

for i in range(len(ctxt)):
    if i % 3 == 0:
        ptxt = ptxt + ctxt[i+2] + ctxt[i]
    elif i % 3 == 2:
        pass
    else:
        ptxt = ptxt + ctxt[i]

print(ptxt)

And that will net us the flag.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: