liveBook · Manning

Prime number

As explained in Hacking Cryptography

A prime number is an integer greater than one that has no positive divisors other than one and itself.

A prime number is an integer greater than one with exactly two distinct positive divisors: 1 and itself. Numbers that can be decomposed further are composite. section 8.2.1

Prime numbers are fundamental building blocks of asymmetric cryptography. Their importance comes from integer factorization: multiplying two large primes is easy, while recovering those primes from their product is computationally expensive. section 8.2 section 8.3.2

Cryptographic prime generation follows a random-candidate-and-test loop:

  • Generate random bytes with an RNG and interpret them as an arbitrary-precision integer. section 8.2.2
  • Test the candidate for primality; reject composite values and repeat until a prime is found. section 8.2.2
  • Use sufficiently large primes in asymmetric key generation, where repeated testing reduces the chance that a candidate is composite. section 8.2.2 section 8.5

Factoring a composite number

The number 764,512 decomposes as 3,413 × 7 × 2⁵. This illustrates the fundamental theorem of arithmetic: every positive integer has a unique representation as a product of prime factors. section 8.2.1

How Hacking Cryptography covers it

How deep it goes
Defines primes, demonstrates factorization, and explains probabilistic testing, but defers detailed asymmetric algorithms.
Examples
Uses 13, 37, 42, and the worked factorization of 764,512 to distinguish primes from composite numbers.
What you can do after
Evaluate candidate integers, follow cryptographic prime generation, and understand its relationship to RSA factorization hardness.
How it connects
Connects prime numbers to asymmetric cryptography, public-key cryptography, integer factorization, RSA, random number generation, and primality testing.

Also explained in

Compare how 5 books explain prime number →

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.