# Break El-Gamal Algorithm by knowing the value of the random k

In El-Gamal Algorithm, the public key is $(p, g, A)$, and the secret key is $(a)$, in order to encrypt some data, the sender generate a random $k$, where: $(C_1, C_2) = (m.A^{k} \pmod{p}, g^{k} \pmod{p})$ If a hacker know the value of $k$, should this break the algorithm security ?

## 1 Answer

Yes, this does break the security for that particular message. If the attacker somehow recovers the value $k$, he can recover the message $m$ by computing $m = C_1 \cdot A^{-k} \pmod{p}$ (where $A^{-k}$ is the multiplicative inverse of $A^k$; one way it can be computed is by $A^{-k} = A^{p-1-k}$)