Rating:

### Quick Explanation

This is a DLP problem where the modulo N is fully factorizable.

Fairly new to `SageMath` so I thought I needed to do some things manually. After solving the problem, I revisited it then realized that you can simply use `SageMath`'s `discrete_log` function and will the most of the stuff that will be discussed in the full solution for you.

```python
p = 122488473105892538559311426995019720049507640328167439356838797108079051563759027212419257414247
g = 2
h = 41265478705979402454324352217321371405801956976004231887598587967923553448391717998290661984177

R = IntegerModRing(p)
x = discrete_log(R(h), R(g))

print(x)
```

Original writeup (https://github.com/pberba/ctf-solutions/tree/master/20180913_sect/matryoskal).