Schlem Encryption

The Schlem has hacked into the CTF site and encrypted the flag that was meant to be gotten in this challenge. We have been unable to reverse the encryption in time for reception, but maybe nØllan can help.

We've found an encryption script on the KTH servers that Schlemet seems to have used. Can nØllan reverse the encryption and get the original flag back?

Encrypted flag }roxacstgorrwqt-vtjgfg{fczdoqun
A classical Greek marble head

Extracted encryption tool

# Script used to encrypt the flag alphabet = "abcdefghijklmnopqrstuvwxyz{}-" ring_1 = [3, 8, 13, 18, 23, 28, 4, 9, 14, 19, 24, 0, 5, 10, 15, 20, 25, 1, 6, 11, 16, 21, 26, 2, 7, 12, 17, 22, 27] ring_2 = [11, 18, 25, 3, 10, 17, 24, 2, 9, 16, 23, 1, 8, 15, 22, 0, 7, 14, 21, 28, 6, 13, 20, 27, 5, 12, 19, 26, 4] ring_3 = [17, 28, 10, 21, 3, 14, 25, 7, 18, 0, 11, 22, 4, 15, 26, 8, 19, 1, 12, 23, 5, 16, 27, 9, 20, 2, 13, 24, 6] flag = input("flag: ") encrypted = "" for step, char in enumerate(flag): index = (alphabet.index(char) + step) % len(alphabet) index = ring_1[index] index = ring_2[index] index = ring_3[index] encrypted += alphabet[index] print(encrypted)
Download script