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.

x012345678910
z68538484974
y––4, 75, 6–2, 9–2, 93, 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).

k12345678910111213
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 = αky1 = kα
y2 = xβky2 = Pm + kβ
x = y2(y1a)−1Pm = 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

RSAECC
Hard problemFactoring n = pqECDLP
Best known attackSub-exponential (number field sieve)Generic O(√n) only
128-bit security3,072-bit key256-bit key
256-bit security15,360-bit key512-bit key
PerformanceFast verify with e = 65537; slow keygen and signing; large signaturesSmall 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.