> For the complete documentation index, see [llms.txt](https://simon-6.gitbook.io/simoncyber/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simon-6.gitbook.io/simoncyber/ctf-writeups/picoctf-2025/reverse-engineering/quantum-scrambler-medium.md).

# Quantum Scrambler (Medium)

### The Challenge

<figure><img src="/files/5UhRFVBbQTp5lPxAsycZ" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/rGDjTs63WFnf6JFf4S0j" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/mQQYDf9YJLsdXEAm4fs2" alt=""><figcaption></figcaption></figure>

***

It starts of with getting the flag and stripping its whitespace. Then, for each character it converts them into hexadecimal equivalents and appends them into a new list.&#x20;

The source code itself doesn't remove or encrypts anything, it just jumbles them around with the indexes. I tried to understand the scramble manually at first, but that didn't work out to be anything meaningful.&#x20;

{% hint style="info" %}
One thing that should be noted is that the .pop() method removes the element at the given index and ALSO returns that removed element.&#x20;
{% endhint %}

I watched a youtube video that cleverly explained some of it, and I realized that there was a pattern to the hex. I nano a test flag.txt using the string "ThisFLAG" and ran it through the python file.

```
python3 quantum_scrambler.py 
```

<figure><img src="/files/soSNvyKyuZODz7qKhnb8" alt=""><figcaption></figcaption></figure>

Since I knew what the plaintext was, it was easy to figure out the order. Essentially, it's the first and last element of every list. I needed to write a short python script to then figure this out.

***

After 1-2 hours, I'm calling it quits. I understand the answer but I couldn't really figure out the script.

{% embed url="<https://www.youtube.com/watch?v=e29X-4W0bOg>" %}

This video includes it!&#x20;
