> For the complete documentation index, see [llms.txt](https://digitalgarden.batamladen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://digitalgarden.batamladen.com/writeups/ctfs/0xfun-ctf-2026/crypto-the-slot-whisperer.md).

# Crypto - The Slot Whisperer

We were given a remote service:

```
nc chall.0xfun.org 37246
```

It prints 10 numbers and asks us to predict the next 5 spins.

We are also given the source code:

```python
class SlotMachineLCG:
    def __init__(self, seed=None):
        self.M = 2147483647
        self.A = 48271
        self.C = 12345
        self.state = seed if seed is not None else 1

    def next(self):
        self.state = (self.A * self.state + self.C) % self.M
        return self.state

    def spin(self):
        return self.next() % 100
```

***

***

## 🧪 Solver Script

```python
M = 2147483647
A = 48271
C = 12345

observed = [53,69,99,55,16,48,45,80,10,6]

for k in range(M // 100):
    state = 100*k + observed[0]

    ok = True
    tmp = state

    for i in range(1, len(observed)):
        tmp = (A * tmp + C) % M
        if tmp % 100 != observed[i]:
            ok = False
            break

    if ok:
        print("Found state:", state)

        # predict next 5
        for _ in range(5):
            tmp = (A * tmp + C) % M
            print(tmp % 100, end=" ")
        break
```

Flag:\
`0xfun{sl0t_wh1sp3r3r_lcg_cr4ck3d}`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://digitalgarden.batamladen.com/writeups/ctfs/0xfun-ctf-2026/crypto-the-slot-whisperer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
