# How to measure the complexity of the discrete logarithm problem?

The answers to this question on Crypto Stack Exchange basically says that, to measure the complexity of the logarithm problem, we have to take the length of the number representing the size of the group into account. It seems arbitrary, why don't we chose the size of the group as the argument? Is there a criterion to know what argument to chose? In fact, I know I overlooked something important since the complexity changes hugely if we do it by the size of the group.

• Interesting question! I edited it to say "measure the complexity", rather than "calculate" it, since the answer to how we calculate it is ¯\_(ツ)_/¯. :-) – David Richerby Oct 22 '16 at 16:40
• I think it's better that way. :) – Nassim HADDAM Oct 22 '16 at 16:51

## 1 Answer

It doesn't matter whether you choose the size of the group $|G|$ or the size of the integer representing it $n$ as a parameter, since $n \approx \log |G|$. There are two reasons that usually the complexity is described in terms of $n$ rather than $|G|$:

1. $n$ is the length of the input (more accurately, the input has length $\Theta(n)$), and we usually measure the complexity of algorithms as a function of the input length.

2. Usually $n$ is a small number such as $1024$, whereas $|G|$ is a huge number such as (roughly) $2^{1024}$.

• I see your point, but doesn’t it make it a problem in P if we chose the size of the group as a parameter? – Nassim HADDAM Oct 22 '16 at 18:27
• You cannot choose the parameter in that case – the parameter is always the input length. – Yuval Filmus Oct 22 '16 at 18:28
• Thanks for the answers. I had a problem with what might happen if we consider the other case (problems in P becoming in NP and the other way around). I can see clearly now :) . – Nassim HADDAM Oct 22 '16 at 19:25
• We don't do the calculation in unary since our goal is to factor some number or to compute some discrete logarithm, and we don't care how the number is represented. Giving it as input in binary or unary doesn't affect the "wall time" needed for solving the problem, only its complexity in terms of the input size (since we are changing the input size!). – Yuval Filmus Oct 23 '16 at 6:07
• Besides, we cannot really have a 128-bit long integer as unary input to a real-world algorithm. There are not enough atoms in the universe. – Yuval Filmus Oct 23 '16 at 6:08