# Why is the following not a ZKP for discrete log?

Before looking at the textbook ZKP for discrete log, I tried to construct one myself. This turned out quite different to the textbook one, and I've been wondering what might be wrong with it? (I was unable to refute any of the ZKP requirements, so I guess I'm missing something).

The original problem:

Given $$g,h \in \mathbb{Z}_p^x$$ ($$g$$ being the generator), provide a ZKP for the knowing $$x \in \mathbb{Z}_p^x$$ such that $$g^x=h$$.

My suggestion:

• The verifier chooses a random $$r\in \mathbb{Z}_p^x$$ and sends $$h^r$$ to the prover.
• The prover sends back its best guess for $$g^r$$, denoted $$a$$.
• The verifier asserts that $$a=g^r$$.

If the prover indeed knows $$x$$ then he will send: $$a=(g^{rx})^{x^{-1}}=g^r$$.

If the prover does not know $$x$$ then, in order to get $$a=g^r$$ from knowing $$g^{rx}$$ he has to solve discrete log for $$(g^r)^x$$ to recover $$g^r$$, i.e. discrete log for $$g^x$$.

If the verifier is dishonest, I don't see how he can gain an edge on discovering $$x$$.

What am I missing?

• How would you go about proving knowledge soundness? How would you prove zero knowledge? Aug 24, 2022 at 8:07
• “In order to get $g^r$ from $g^{rx}$ [the prover] has to solve discrete log”: this is not how the discrete log problem is defined. The DLP asks for the exponent of some element (relative to some fixed base), but here you are asking for the “$x$th root” of the element $g^{rx}$, which is very different. This might or might not be hard to compute, but it’s not the discrete log. Formally, you would need to show a knowledge extractor that computes $x$ after interacting with the prover according to the protocol, and it’s not clear how to do that for this protocol. Aug 27, 2022 at 11:41

In particular your protocol is not ZK against a malicious verifier. This is easy to see, since the verifier could be choosing some arbitrary group element $$f$$ instead of $$h^r$$ and then the verifier would learn $$f^{1/x}$$. This is some extra information that the verifier isn't supposed to learn.
• This answer is not quite as satisfying as one might hope for. If we're talking about computational ZK, the simulator does not need to produce $f^{1/x}$, but only something indistinguishable from it. It may not be immediately obvious that that's not possible. Aug 25, 2022 at 7:02