liveBook · Manning

Square and multiply

Square and multiply is an exponentiation algorithm that repeatedly squares and conditionally multiplies according to the exponent’s binary representation.

How 2 Manning books explain it

Hacking Cryptography

The square-and-multiply method is an efficient exponentiation algorithm that repeatedly squares and selectively multiplies according to the exponent bits.

How it is used
Implements modular exponentiation efficiently while exposing a potential timing and power side channel.
How deep it goes
Defines the bit-scanning procedure, explains its binary arithmetic, and connects conditional multiplication to exponent-revealing traces.
Examples
Uses exponent 42, its binary form 101010, a step table, and an RSA power trace.
What you can do after
Evaluate exponentiation implementations for operation-pattern leakage from secret exponent bits.

Read how Hacking Cryptography explains square and multiply →

Elliptic Curve Cryptography for Developers

Square-and-multiply is an exponentiation algorithm that repeatedly squares and conditionally multiplies according to the binary representation of the exponent.

How it is used
Computes high powers of polynomials modulo prime polynomials for field extensions, irreducibility tests, and elliptic-curve pairings.
How deep it goes
Explains binary decomposition, modular reductions, operation counts, a worked example, and C-style routines, but not side-channel behavior.
Examples
Works through x^5 modulo x^2+x+3 over mod 43 and supplies polynomial exponentiation flow and C-style listings.
What you can do after
Build it from scratch using modular polynomial multiplication, binary exponent scanning, conditional multiplication, and explicit temporary cleanup.

Read how Elliptic Curve Cryptography for Developers explains square and multiply →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.