ElGamal Encryption and Homomorphic Addition

Prof Bill Buchanan OBE FRSE
4 min read5 days ago

With ECC (Elliptic Curve Cryptography), we take points on a defined curve — such as secp256k1 — and then perform point addition and subtraction. With secp256k1 (and which is used by Bitcoin and Ethereum), we have an equation of:

and where:

The base point (G) is:

(55066263022277343669578718895168534326250603453777594175500187360389116729240, 32670510020758816978083085130507043184471273380659243275938904335757337482424)

and the order (n) — the number of points on the curve - of the curve is:

n=237316195423570985008687907852837564279074904382605163141518161494337

First, Alice first creates a private key (ka) — and which is a random scalar value — and then creates a public key (Qa) of:

and where G is the base point on the curve. If Bob wants to send Alice an encrypted message (m), he creates a random value (r) and uses her public key (Qa) to produce a cipher message of:

and:

Bob sends Alice: (c1,c2). Alice will now use her private key (k_a) to recover the message:

This works because:

We can then solve this for m by testing for 1.G, 2.G , and so on. An overview is:

--

--

Prof Bill Buchanan OBE FRSE
Prof Bill Buchanan OBE FRSE

Written by Prof Bill Buchanan OBE FRSE

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.

No responses yet