WxMCTF '24 Rev 4 - Recursive Combinatorics
After effortlessly beating Ansh in multiple math contests, Jerry went on a well-deserved three-week vacation. However, Ansh, salty about Jerry's triumph, decided to create an even harder challenge for Jerry — one that has Jerry's least favorite topics: recursion and combinatorics.
Not wanting to use up all of Jerry's vacation time, Ansh generously provided Jerry with the following instructions:
The Challenge
Contained within the file rev4.py
, you'll find a Python function called go()
. This function is your target.
Your mission is straightforward: Determine the output of the go
function when it's given the input of 1 trillion. Lets say this value is a
Once you've successfully calculated the value a
, your next step is to use it to access a unique URL for accessing the rentry page. To do this, follow these steps:
- Calculate the SHA-512 hash of the result of
a XOR b
, where b
is the first Mersenne prime with 157 digits.
- After obtaining the complete SHA hash, take the last 8 characters of this hash.
- Construct the rentry URL by appending these 8 characters to the base URL. For example, if the last 8 characters of the SHA hash are 28559d4f, the rentry URL will be formed as: https://rentry.co/28559d4f.
- It's important to note that the specific rentry link provided (https://rentry.co/28559d4f) does not exist. Your calculated 8 characters will access a unique rentry page where the flag can be found.
Jerry really didn't want to do this question, as he was on vacation. Can you help him do it?