Cryptography challenges in HSCTF 10


double-trouble

image

There was a given pdf file with the challenge.

image

Thanks to the hint, it is caesar cipher.

image

So decrypting the small part.

image

Flag: flag{CaesarCiphersAreCool}


really-small-algorithm

image

Putting the numbers into a decoder gives flag.

image

Flag: flag{bigger_is_better}


cupcakes

image

I tried vigenere cipher which needed a key.

image

Flag: flag{instantbatter}


trios

image

image

Error in data.txt as it is not a multiple of 3:

IIqrBRz → IqrBrz
S4mLtKOIqr2stRbcQHJAPR2svphjHu0 → 4mLtKOIqr2stRbcQHJAPR2svphjHu0

Looks like a substitution cipher but each letter is represented by a random group of 3 characters. So, just assign each group of 3 into a letter and use quipqiup.

g = ""
bad = ",.\n {}"
with open("data.txt", "r") as f:
    for c in f.read():
        if c not in bad:
            g += c

abc = [chr(i) for i in range(97, 123)]
g = [g[i:i+3] for i in range(0, len(g), 3)]
# split into groups of 3
found = []
s = ""
i = 0
for k in g:
    if k not in found:
        found.append(k)
        s += abc[i]
        i += 1
    else:
        d = found.index(k)
        s += abc[d]
# assign 1 letter for each group
print(s)

>>> "abcdebefgchijhekclijmjbnechehoplfieqremmcdesakethjksimbchducdesmijashqcqsaaepehifbcshievijaigemcrebchducdebjhdehjudgijasbbjhemgeeijpmjchqigehkeojuhiigejoouppehoemjaecogbeiiepimsbbedcbijjkhwumijhedushecfsdshksixepbchq"

image

Flag:flag{elephant}