PentaHex

Splyt (96) - Crypto


Bob splitted a secret and gave some pieces of it to some of his friends. We managed to convince Eve and Chris to give us their shares.

We are given a tar file with the files implementing the split and join functions of the shares.


This problem was an implementation of Shamir's Secret Sharing Scheme in Python. You could solve this problem without knowing that, though.

There's a build.sh file with the commands that were run to generate this problem. After messing around with the code to try to make it work right, I realized that the flag was split into 20 parts, and 13 were needed to join it back together. We only have 3. I looked at the split functions, in __init__.py. The pick_coefficients function is only ran once, so there is only one random number generated from the split function, and it's reused in each of the shares.

In the challenge.json file, there are 3 shares. The array has a number corresponding to each letter in the flag.

We have the following y array in the challenge.json:

[26, 32, 21, 27, 47, 38, 230, 41, 39, 228, 34, 27, 19, 38, 231, 34, 24, 227, 33, 19, 228, 39, 19, 34, 227, 40, 19, 26, 41, 34, 49, 189]

In the end, you don't need to know any of the technical details. We know the string starts with "flag." f=26,l=32,a=21,g=27,{=47

Now we can figure out all the letters in our flag. a=21,b=22,c=23,...,z=46

From this, we can get the following string:

flag{r?us?ng?r?nd?m??s?n?t?fun??

We're seeing that 19 a lot, so it probably separates the words. Since this is a flag, it's probably an underscore:

flag{r?us?ng_r?nd?m_?s_n?t_fun??

A common occurence in flags is to replace the letters with numbers (0=O,1=I,3=E,4=A,5=S,7=T,8=B). Since there are a lot of unknowns in our flag still, they might be numbers representing letters. Near the end of the flag, the n?t is probably "not" with a 0 replacing the o. 0=227,1=228...:

flag{r3us1ng_r4nd0m_1s_n0t_fun??

We know {=47, so the } is likely the 49. There's a leftover character, but we don't need to worry about that!

flag{r3us1ng_r4nd0m_1s_n0t_fun}