Points: 20
Category: Crypto


Brute and get the base 32 format of flag.

This task is worth 20 points, but only 8 teams have solved it during ctf and I really wonder why.

Before we start, I assume that everyone knows how base32 works: link.


Task description tells us that flag is converted to base32 and somehow encrypted.

From other tasks we know flag format and when we compare it with ciphertext length, we can assume that plaintext looks like this: BITSCTF{*************}.

Let’s encode first five letters of flag (one block of base32), BITSC to base32: IJEVIU2D.

Compare first 5 letters of base32 plaintext and ciphertext:

We can notice that every letter in ciphertext decodes to distinct letter in plaintext (with M decoding twice to I), so we can guess that this is kind of monoalphabetic substitution cipher.

Let’s look for any patterns in ciphertext alphabet.

Our alphabet(all base32 letters):

Encrypting alphabet


When we look closely we can see that this is encrypted with affine cipher, with a = 13 and b = 4.

By the way, after finding that pattern we realize that title of this task is anagram of affine word.

So our encrypted alphabet will look like this:

Now we can get our plaintext:

After that we need to add b32 padding and finally we can read our solution:

Easter egg:
flag is base64 of string ‘Kerckhoff’:

Kerckhoffs’s principle.

1 Comment » for BITSCTF 2017: fanfie
  1. Bikram puhan says:

    It is the best

Leave a Reply

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


Share This