# ✖️Scalar Multiplication in Python

Scalar multiplication forms the basis of elliptic curve cryptography. We can easily express multiplication of a point by a scalar in the form of repeated additions.

The **binary expansion **technique can significantly speed the scalar multiplication process, and ensure that any scalar multiplication would require no more than 510 point addition operations.

Let's say we want to compute the value of $10P$. Then instead of doing point additions naively, like: $P + P + P + P + P + P + P + P + P + P$ , we can use binary expansion to achieve the same with just 4 point additions: $P + P = 2P$ $2P + 2P = 4P$ $4P + 4P = 8 P$ $8P + 2P = 10P$

We can now verify the correctness of the generator point used in Bitcoin, as follows:

The security of elliptic curve cryptography relies on the difficulty of reversing the scalar multiplication. This is is known as the discrete logarithm problem.

If one did

, it is computationally impossible to find out how many times she added **G + G + G + G + ... + G = P**`G`

to itself, in order to obtain `P`

.

### Resources

Goundar, Raveen R., et al. "Scalar multiplication on Weierstraß elliptic curves from Co-Z arithmetic." Journal of cryptographic engineering 1.2 (2011): 161. https://www.matthieurivain.com/files/jcen11b.pdf

Last updated