Skip to content
Startseite » picoCTF Mod 26

picoCTF Mod 26

The picoCTF Mod 26 is about ROT13, a special type of the caesar substitution cipher. In the caesar cipher you define an offset of which every character of the plaintext is shifted along the alphabet to create the encrypted text. So if you define an offset of 5, an ‘A’ become ‘F’, a ‘B’ become ‘G’ and so on and at the end of the alphabet, you start at the beginning again. Therefore the name “ROT” because you rotate the position of the letters and “13” because of the offset of 13. The “ROT13” is special because the alphabet contains 26 characters. So if you shift the characters with an offset of 13 twice, you are right at the same text where you’ve started.

There are lot’s of “ROT13” solver out there in the wides of the internet, but it is more fun to write some code yourself so here is a small python script to decrypt the flag:

import string

uppercase = string.ascii_uppercase
lowercase = string.ascii_lowercase

offset = 13

encrypted_flag = "encrypted flag..."
decrypted_flag = ""

for c in encrypted_flag:
    if c in uppercase:
        decrypted_flag += uppercase[(uppercase.find(c) + offset) % len(uppercase)]
    elif c in lowercase:
        decrypted_flag += lowercase[(lowercase.find(c) + offset) % len(lowercase)]
        decrypted_flag += c


Simply change the encrypted flag in the script and run it to get the decrypted flag.

Leave a Reply

Your email address will not be published. Required fields are marked *