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: