Rating:

![image](https://github.com/jeromepalayoor/ctf-archive-hub/assets/63996033/5820117f-ad55-426b-addb-02486290ebd9)

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](https://quipqiup.com/).

```py
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](https://github.com/jeromepalayoor/ctf-archive-hub/assets/63996033/64abcd78-ab2c-498a-a821-4019b2d22265)

Flag:`flag{elephant}`

Original writeup (https://jpalayoor.com/cryptography/HSCTF-10.html#trios).