# Does changing the random number selected for each message increase security in Schnorr's scheme?

I was reading about Schnorr's scheme and in that for signing the signer generates a random
number and continues with his operation. I am trying to implement this in a scenario where
the signature length is small and the number of possible messages is also very small.

Is generating a random number and signing, for each message also a good option in this case?

• well, the reason is the same with ElGamal, if you use same random number to sign two messages, then the adversary can recovery the secret key which is used for signing.
– T.B
Jan 26 '14 at 6:51

A small message space is no problem and I do not really know what you mean by "signature length is very small".

However, it is not only a good idea to choose independent and fresh randomness for every signature, it is (as Alex mentioned in his comment) necessary. Otherwise anyone who gets two signatures of you computed with same randomness for different messages can extract your private signing key with overwhelming probability.

I'm using the notation from the Wikipedia article of Schnorr signatures.

Assume you have two signatures $(s,e)$ and $(s',e')$ for two messages $M\neq M'$. Using the same randomness means that $r=r'$ (since $k=k'$) and since $M\neq M'$ in practice we will have that $s\neq s'$ ($H$ is a secure cryptographic hash function and would need to collide).

Now, we know that $s\equiv k-xe \pmod q$ and $s'\equiv k-xe' \pmod q$.

Consequently, since $k$ (the randomness) is identical for both signatures, we have that

$s+xe \equiv s'+xe' \pmod q$ and thus $s-s' \equiv x(e'-e) \pmod q$ and thus

$x\equiv (s-s')(e'-e)^{-1} \pmod q$.

Ignoring the very unlikely cases where $s-s'$ and $e'-e$ are $0$, and since $(e'-e)^{-1}$ thus always exists, the attacker can extract $x$, which is the private key.

So, when using Schnorr's signature, it is essential, that the value $k$ is chosen independently and randomly for every signature such that these "randomness collisions" do not happen.

All ElGamal type signatures (such as DSA/ECDSA) suffer from the same problem when re-using the randomness $k$ and actually this is what doomed Sony's private key back in 2010/2011 (i.e., they re-used $k$ over different signatures).

• Doesn't finding $(e′−e)^{−1}$ s.t $x(e′−e)(e′−e)^{−1} \equiv x$ involve finding the discrete log of $x(e′−e)$. For instance if find these inverses is easy why not find $G^{-1}$ so that you can determine the secret key $x = (kG)(G^{-1})$. Jan 15 '17 at 21:05
• @EthanHeilman Note that $(e'-e)$ can easily be inverted as it is in $\mathbb{Z}_q$. The point is that this helps us computing $x$ using the last equation above. Your equation $x=(kG)(G^{-1})$ makes no sense. Is $G$ your basepoint from an elliptic curve? What is $k$ in your equation? Anyways, let us write $G^{-1}$ as $-G$ (as you write the group additively) and what you get is: $kG-G=(k-1)G$. That doesn't help you. Jan 16 '17 at 8:30
• I figured out what I was doing wrong last night. I am not used to some of the quirks of EC notation. $kG$ is actually a different operation than say $kx$. Finding $G^{-1}$ would break discrete log, finding $k^{-1}$ is trivial. Jan 16 '17 at 16:52