Learn › Blockchain & Access Control › Module 2 · Public-key cryptography
ECC over prime fields, quadratic residues, EC-ElGamal and RSA vs ECC
Elliptic curves modulo a prime, quadratic residues and Euler's criterion, all points and multiples of a generator on y² = x³ + x + 6 over Z₁₁, an EC-ElGamal round trip, and why ECC beats RSA on key size.
Curves over Zp
Real-number curves suffer rounding; cryptography uses exact arithmetic over a prime field (p > 3). E is the set of (x, y) ∈ Zp × Zp with y2 ≡ x3 + ax + b, 4a3 + 27b2 ≢ 0 (mod p), plus O.
λ = (y2 − y1)(x2 − x1)−1 (addition) or (3x12 + a)(2y1)−1 (doubling), mod p.
x3 = λ2 − x1 − x2; y3 = λ(x1 − x3) − y1; −(x, y) = (x, p − y).
Division becomes multiplication by a modular inverse.
Quadratic residues and Euler’s criterion
z is a quadratic residue mod p if y2 ≡ z has a solution. Exactly (p − 1)/2 non-zero values are residues: mod 11 they are {1, 3, 4, 5, 9}.
Euler: z is a QR ⇔ z(p−1)/2 ≡ 1 (otherwise ≡ −1).
If p ≡ 3 (mod 4): the roots are ±z(p+1)/4 mod p.
Worked curve: y2 = x3 + x + 6 over Z11
4 + 27·36 = 976 ≡ 8 ≢ 0, so non-singular. Since 11 ≡ 3 (mod 4), roots are ±z3.
| x | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| z | 6 | 8 | 5 | 3 | 8 | 4 | 8 | 4 | 9 | 7 | 4 |
| y | – | – | 4, 7 | 5, 6 | – | 2, 9 | – | 2, 9 | 3, 8 | – | 2, 9 |
12 affine points + O = 13 points. Because 13 is prime, every point except O generates the group.
Multiples of α = (2, 7)
2α: λ = (3·4 + 1)(14)−1 = 2·3−1 = 2·4 = 8; x = 64 − 4 = 60 ≡ 5; y = 8(2 − 5) − 7 = −31 ≡ 2 ⇒ (5, 2).
3α = (5, 2) + (2, 7): λ = 5·(−3)−1 = 5·7 = 35 ≡ 2; x = 4 − 7 ≡ 8; y = 2(5 − 8) − 2 ≡ 3 ⇒ (8, 3).
| k | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| kα | (2,7) | (5,2) | (8,3) | (10,2) | (3,6) | (7,9) | (7,2) | (3,5) | (10,9) | (8,8) | (5,9) | (2,4) | O |
EC-ElGamal
| ElGamal in Zp* | EC-ElGamal |
|---|---|
| β = αa | β = aα |
| y1 = αk | y1 = kα |
| y2 = xβk | y2 = Pm + kβ |
| x = y2(y1a)−1 | Pm = y2 − a·y1 |
Worked example
Bob: a = 7, β = 7α = (7, 2). Alice sends Pm = (10, 9) with k = 3: y1 = 3α = (8, 3); 3β = 21α = 8α = (3, 5); y2 = (10, 9) + (3, 5) = (10, 2).
Bob: 7y1 = 21α = (3, 5); subtract by adding (3, 6): (10, 2) + (3, 6) = (10, 9).
RSA vs ECC
| RSA | ECC | |
|---|---|---|
| Hard problem | Factoring n = pq | ECDLP |
| Best known attack | Sub-exponential (number field sieve) | Generic O(√n) only |
| 128-bit security | 3,072-bit key | 256-bit key |
| 256-bit security | 15,360-bit key | 512-bit key |
| Performance | Fast verify with e = 65537; slow keygen and signing; large signatures | Small keys and signatures, low bandwidth and memory |
Hence ECC in TLS 1.3 (X25519, P-256), messaging apps, IoT devices and blockchains, where signature size multiplies across millions of transactions.