ElGamal
ElGamal encryption: public key and secret, encryption with a one-time random value, the pair (c1, c2), decryption through the inverse of the mask, and the danger of reusing the random value.
- 22 cards
- 6 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- The numbers
- Scenarios
- Understand
A few cards from the deck
Public value h: what is it?
Show the answer
The power g^x mod p computed with the recipient's secret x, published with p and g so that anyone can write to them.
With p = 23, g = 5 and x = 6, h = 5⁶ mod 23 = 8. Recovering x from h takes a discrete logarithm.
What does this decryption program print?
```python
p, x = 23, 6
c1, c2 = 10, 14
mask = pow(c1, x, p)
m = c2 * pow(mask, -1, p) % p
print(mask, m)`6 106 44 108 10
Show the answer
6 10The mask is 10⁶ mod 23 = 6, its inverse is 4 (6 × 4 = 24 ≡ 1), and the message is 14 × 4 = 56 ≡ 10.
6 4forgets the multiplication by c2,4 10prints the inverse instead of the mask.With the secret x, the public value is h = … mod p; to encrypt, a random k is drawn and c1 = … mod p is computed.
Show the answer
With the secret x, the public value is h = g^x mod p; to encrypt, a random k is drawn and c1 = g^k mod p is computed.
x stays with the recipient; k stays with the sender. Only h and c1 travel, and neither lets you easily go back to its exponent.
Ephemeral value k: what is it?
Show the answer
A number drawn at random by the sender for one message only, which must never be used twice.
It builds the mask h^k. If it repeats, two messages are hidden by the same value and give each other away.