liveBook · Manning

Scalar multiplication

As explained in Hacking Cryptography

Scalar multiplication is an operation that multiplies a mathematical point or vector by a scalar according to the structure's defining rules.

Scalar multiplication multiplies an elliptic-curve point by an integer using the curve’s special addition operation. Writing nP means adding P to itself n times; the result remains a point on the same curve. section 3.2.2

In Go’s elliptic-curve implementation:

  • curve.ScalarMult(...) performs the operation without requiring the caller to implement curve-point addition. section 3.2.2
  • Coordinates use arbitrary-precision integers from math/big, supporting cryptographic point values. section 3.2.2
  • DUAL_EC_DRBG multiplies its internal state by points P and Q, then extracts the x-coordinate; the Q result is truncated before output. section 3.2.3

Using scalar multiplication in DUAL_EC_DRBG

For internal state n, the generator advances with gP(n) = X(nP) and produces output with gQ(n) = t(X(nQ)). The Go implementation calls curve.ScalarMult for P and Q, discards each y-coordinate, and returns the final 30 bytes. section 3.2.3

Equation 3.3
\[\begin{aligned} \begin{aligned} g_P(n) &= X(nP) \\ g_Q(n) &= t(X(nQ)) \end{aligned} \label{equation:dualec-p-and-q} \end{aligned}\]

Equation 3.3 makes the two scalar multiplications explicit: one updates the state, while the other transforms it into output. section 3.2.3

How Hacking Cryptography covers it

How deep it goes
Defines repeated curve addition and demonstrates package calls, while deferring the internal details of point addition.
Examples
Uses points P and Q, Go’s ScalarMult function, and equations for state advancement and truncated output.
What you can do after
Apply it via Go’s crypto/elliptic package to multiply curve points and integrate them into a generator.
How it connects
Connects elliptic curves, point addition, arbitrary-precision integers, and deterministic random bit generators.

Also explained in

Compare how 2 books explain scalar multiplication →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Hacking Cryptography. The section links point to the parts of the book it draws on.