Solution #

You will be given the following file, enc.

1$ bat resources/enc -p
2灩捯䍔䙻ㄶ形楴獟楮獴㌴摟潦弸彤㔲挶戹㍽

The problem description says

1I wonder what this really is...
2''.join([chr((ord(flag[i]) << 8) + ord(flag[i + 1])) for i in range(0, len(flag), 2)])

The enc file should contain the encrypted flag. The flag is encrypted by the following algorithm.

1def encrypt(flag):
2    return "".join([chr((ord(flag[i]) << 8) + ord(flag[i + 1])) for i in range(0, len(flag), 2)])

Thus, we need to decrypt the flag. The following script decrypts the flag.

1def decrypt(flag):
2    return "".join([chr((ord(flag[i]) >> 8) + ord(flag[i + 1])) for i in range(0, len(flag), 2)])

Yeah, we’ve got the flag.

1$ python scripts/transformation.py
2picoCTF{16_bits_inst34d_of_8_d52c6b93}

Acknowledgement #

Thank you, CMU security and privacy experts, for creating this challenge.

References #