Modulus
A modulus is the positive integer that determines equivalence classes, remainder values, and the repeating cycle of modular arithmetic.
Hacking Cryptography
The positive integer that defines the modulus and bounds the residue classes in modular arithmetic.
- How it is used
- Defines the numeric range and recurrence behavior of a linear congruential pseudorandom number generator.
- How deep it goes
- Develops the definition through implementation and derives modulus recovery from output differences and greatest common divisors.
- Examples
- Uses C++ minstd_rand constants, a Go LCG implementation, and an exploit that recovers parameters from generated outputs.
- What you can do after
- Diagnose/debug with it by implementing an LCG and tracing how recovered parameters reproduce future outputs.
Real-World Cryptography
A modulus is the positive integer that determines the equivalence of values by their division remainders in modular arithmetic.
- How it is used
- Uses modular arithmetic to construct operations in Diffie-Hellman and RSA cryptographic systems.
- How deep it goes
- Defines remainders, wraparound, multiplication, inverses, and RSA exponentiation without developing formal proofs.
- Examples
- Uses clock wraparound, 7 ≡ 2 (mod 5), 3 × 2 ≡ 1 (mod 5), and RSA encryption of 2 modulo 5.
- What you can do after
- Apply it via modular arithmetic to interpret remainders and follow basic cryptographic exponentiation.
Elliptic Curve Cryptography for Developers
The modulus is the positive integer that defines the equivalence classes and wraparound behavior in modular arithmetic.
- How it is used
- Uses the modulus to implement finite-field arithmetic and manage field domains in cryptographic computations.
- How deep it goes
- Explains wraparound, congruence, GMP routines, polynomial reduction, inverse checks, and modulus switching, stopping short of full number-theory proofs.
- Examples
- Uses clock arithmetic, a prime field modulo 43, GMP C routines, polynomial reduction, and CRS modulus switching.
- What you can do after
- Builds GMP-backed modular arithmetic and configures the modulus for polynomial and elliptic-curve cryptographic operations.
Read how Elliptic Curve Cryptography for Developers explains modulus →
Related concepts
- irreducible polynomialconfigured by · An irreducible polynomial is a nonconstant polynomial that cannot be factored into lower-degree nonconstant polynomials over the specified coefficient field.
- checksumproduces · A checksum is a value computed from data and used to detect unintended changes or corruption by comparison with a reference value or recomputation.
- mpz_modused by · mpz_mod is an operation that computes the remainder of integer division.
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.


