# when to do elgamal exponentiation computation

Recetly while studying about cryptographic primtives, I have come across below line in wiki : http://en.wikipedia.org/wiki/ElGamal_encryption

Encryption under ElGamal requires two exponentiations; however, these exponentiations are independent of the message and can be computed ahead of time if need be.

Does "if need be" in the sentence refering to a static key? or is he saying that we can compute an ephemeral key prior to encryption and send to receiver, then later send the encrypted ciphertext at some other time.

If he is not refering to ephemeral key, I still want to know, are there any times we can really implement such a process using ephemeral.

-

What this means is, assuming one potential receiver's public key $h$, that you can choose $y_1,\ldots,y_k$ offline and compute offline the values $(g^{y_1},h^{y_1}),\ldots,(g^{y_1},h^{y_1})$ and store them. Observe, that these values have nothing to do with the messages you want to encrypt (which are not yet known at this point in time).
Then, when you want to encrypt some message $m$ and send it encrypted to the holder of the public key $h$, you simply take an item from the stored list, say the $i$'th entry, set the ciphertext as $(c_1,c_2)=(g^{y_i},m\cdot g^{y_i})$ and send it. Observe, that now this only costs a single multiplication of one of the pre-computed values with the message $m$.
After having sent this ciphertext, you remove the $i$'th entry from the list.