# Gold Bug Trail
The starting point for this puzzle was a [pdf](https://bbs.goldbug.cryptovillage.org/puzzles/2023/GoldBugTrail.pdf) which looked like:

It had some pigpen cipher text on the top which read "FOR FOUR TO SIX PLAYERS", a QR code which decoded to
```
x=1
y=45339167beaeb4f4f2c9412f245
```
and various visual references to the Oregon Trail computer games.
Initially, only the first page of the pdf was released with the puzzle, but as the puzzlehunt continued and the puzzle went unsolved, all of the pages were made available online.
The clues in the pdf as well as the format of the data in the QR code hinted that a secret sharing scheme is being used to hide the answer, and that shares can be found in various physical locations around the DEF CON venue (the first one was at the Gold Bug table in the contest hall). Throughout the day, we found 5 out of the 6 shares:
```
1 45339167beaeb4f4f2c9412f245 Contest Area
2 299ef5218cea745f5b983df5ba0 RF Village
3 ???
4 2f7d9ff8a0b4634873a5fc1de17 Lockpicking Village
5 406d5ffdb5110025542bad818a8 Aerospace Village
6 4fb0625904f1a9868ddfe070fc0 Crypto & Privacy Village
```
The pigpen cipher text hints that the scheme is a (4,6) threshold secret sharing scheme which meant we only needed four shares to reconstruct the secret.
We tried to reconstruct the secret for a while but wasn't successful. Later, a [hint was released](https://twitter.com/CryptoVillage/status/1690558799650897922) which provided the Python script used to create the shares. We used the same library to recover the secret and got the answer.
```python=
from pyseltongue import points_to_secret_int
SHARES = [
(1, 0x45339167beaeb4f4f2c9412f245),
(2, 0x299ef5218cea745f5b983df5ba0),
(3, 0x6522e5d5e0749c40d3ab5444f52),
(4, 0x2f7d9ff8a0b4634873a5fc1de17),
(5, 0x406d5ffdb5110025542bad818a8),
(6, 0x4fb0625904f1a9868ddfe070fc0),
]
shares = [f'{a}-{b}' for a, b in SHARES]
sec = points_to_secret_int(SHARES)
x = str(sec)
flag = ''.join([chr(0x41+int(x[i:i+2])) for i in range(0,len(x),2)])
print(flag)
```
::: spoiler Answer
RIBBITBLUBYUMMY