Role of Fermat's little theorem in the proof of correctness of ElGamal signature In the Wikipedia article about the ElGamal signature scheme it is written, that Fermat's little theorem is used in the following proof of correctness:

From the signature generation in ElGamal we can derive, that:

$$H(m) \equiv xr + sk \pmod {p-1}$$

Then - the article states - Fermat's little theorem implies the following:

$$\begin{align}
g^{H(m)} &amp;\equiv g^{xr}g^{ks}   &amp;\pmod p\\
         &amp;\equiv (g^x)^r(g^k)^s &amp;\pmod p\\
         &amp;\equiv (y)^r(r)^s     &amp;\pmod p
\end{align}$$

The proof makes sense to me, i am just wondering, in what way Fermat's little theorem is used here, instead of just regular properties of exponentiation.
Thanks to fgrieu's comment above and the following quote from here (PDF):


  Theorem:
  
  Let $p$ be a prime and let $a$ be a number not divisible by $p$. Then if
  $$ r \equiv s \pmod {p − 1} $$
  we have
  $$ a^r \equiv a^s \pmod p$$ In brief, when we work $\mod p$, exponents can be taken $\mod{p − 1}$.


I (think i) understood, how the first (implicit) step relies on Fermat's little theorem:
$$\begin{align}
g^{H(m) \pmod{p-1}} &amp;= g^{xr+sk \pmod{p-1}} \\
g^{H(m)} &amp;\equiv g^{xr+sk} \pmod p
\end{align}$$