Official discussion thread for Rookie Mistake. Please do not post any spoilers or big hints.

God that last trap got me killing myself inside LOL

That being said, am I getting senile or should this work in Sage?

```
sage: discrete_log(Mod(23, 7 * 13), Mod(4, 7 * 13), ord=6 * 12)
ValueError: No discrete log of 23 found to base 4
```

whereas the answer should be 5? If you change `ord`

to 6 (its real order) the same occurs.

Had to whip out my own implementation to get this to work.

Nice challenge @willwam845!

@ngoctnq This is indeed weird in my opinion. It does work for ord = 6, or without specifying an order in my case

```
sage: discrete_log(Mod(23, 7 * 13), Mod(4, 7 * 13), ord=6)
5
sage: discrete_log(Mod(23, 7 * 13), Mod(4, 7 * 13))
5
```

But as the doc states: `ord - integer (multiple of order of base, or None)`

, any multiple should work… but it doesn’t…

@ArtemisFY Hey, thanks for the help with the other chall BTW, which version of Sage are you cranking? I tried both 9.1 and 9.2 through `conda`

and both are bad. Guess I’ll file a bug report or something.

Edit: Weird. `ord=6`

(and consequently the code to solve this problem) works now on my machine. Can’t trust anything these days.

So googling around, I got a way to reverse the second part of the flag but for the first part I’m at a bit of a loss. Is it similar to the second half decryption?

I really don’t understand how to solve the first one since some important values are not co prime

@underc0very0 For the first part, I don’t know if this is hinting too much but it’s likely that the non-coprime part doesn’t wrap around the modulus. And even if it does, there’s an algorithm for it

Hope this hint helps Fukurou too.

I solved the first part very easily but stuck at the second part

I think for anyone stuck on the first part he can use some learning from cryptohack.org

i feel really shocked that most of you guys solving the second part before the first

I googled a lot but found nothing

hope someone drops a hint for the second part soon

Nice challenge @willwam845

The second part is definitely easier than the first. Google is your friend and plenty of hints already. If you are still stuck on the first part, here is my hint: DONT think about RSA, what would you do to unsquare a number?

I had to take a math course to solve this…

Hello everyone!

I have solved the DH part but I am really stuck on the RSA part. I think I have found what mathematics are required but I don’t know how to use them to solve the problem…

Any nudge in pm would be appreciated!

Type your comment> @Artf7 said:

Nice challenge @willwam845!

@ngoctnq This is indeed weird in my opinion. It does work for ord = 6, or without specifying an order in my case

`sage: discrete_log(Mod(23, 7 * 13), Mod(4, 7 * 13), ord=6) 5 sage: discrete_log(Mod(23, 7 * 13), Mod(4, 7 * 13)) 5`

But as the doc states:

`ord - integer (multiple of order of base, or None)`

, any multiple should work… but it doesn’t…

~~I’m not totally clear about what the ~~ `ord`

parameter actually exists for, though-- doesn’t sage automatically calculate it?*edit: Ok nevermind, I think I figured out why one might want to do that (especially in this case)*

~~And in @ngoctnq’s example, the integer ~~ `6*12`

isn’t a multiple of the base, so why would it be expected to work?*edit: order ≠ base, nevermind*

@JumpingLlama said:

And in @ngoctnq’s example, the integer

`6*12`

isn’t a multiple of the base, so why would it be expected to work?

`6*12`

is a multiple of the order of the base `Mod(4, 7 * 13)`

, which is 6:

```
assert (4 ** 6) % (7 * 13) == 1
```

Edit: Does anyone know why Markdown does not work?

@ngoctnq said:

`6*12`

is a multiple of the order of the base`Mod(4, 7 * 13)`

, which is 6:

I was confused. You are right. The base is 4, and

`Mod(4, 7*13).multiplicative_order() == 6`

, and

the desired order is 6*12=72.

When I examine the source in generic.py, as well as the pattern of which values of `ord`

are accepted by discrete_log(), I don’t readily understand why it likes some and not others, either.