Sophie Germain Prime Project
Sophie Germain

The Sophie Germain Prime Project primarily aims to collect, analyse and distribute Sophie Germain primes. Such special prime numbers p have the additional condition that 2p + 1 is also prime (called a safe prime). Additional categorisation is provided for Safe primes (prime p with (p-1)/2 also prime) and Blum primes (p = 3 mod 4). Sophie Germain primes find extensive use in public key cryptography (like the Diffie-Hellman key exchange, SGCM and BBS) and primality testing (in the AKS primality test). A conjecture states that there are infinitely many Sophie Germain primes, but this remains an open question in number theory. A heuristic estimate for the amount of Sophie Germain prime numbers below n is given by V. Shoup's A Computational Introduction to Number Theory and Algebra as approximately 2Cn/ln(n)^2 ≈ 1.32032n/ln(n)^2 where C is the twin prime constant. The estimate asymptotically attains the real value of 2C∫₂ᴺdx/(log x · log(2x + 1)). It is surprisingly good:

N Actual Estimate
1,000 37 39
100,000 1,171 1,166
10,000,000 56,032 56,128
100,000,000 423,140 423,295
1,000,000,000 3,308,859 3,307,888
10,000,000,000 26,569,515 26,568,824

The project is maintained by Kamila Szewczyk. It was first created to facilitate her research on the Blum-Blum-Shub random number generator and related cryptographic algorithms (like the Blum-Goldwasser cryptosystem). Large Sophie Germain primes (as big as 4096 bits) are used in the BBS generator to fulfill elementary security requirements; unfortunately they also take a long and generally unpredictable amount of time to find.

Some bounds on the security of BBS, like the one given by A. Sidorenko and B. Schoenmakers, Concrete Security of the Blum-Blum-Shub Pseudorandom Generator, suggest that the security of the BBS generator is strictly tied to the hardness of QRP and factorization, providing concrete values of n=pq and j. They suggest n=6800 bits in the modulus for a tangible level of security (under some assumptions about the running time of the GNFS), much higher than previously understood as safe estimates of n=768 bits.

The API is intended to be used as follows:

  • GET /sophie-germain/count - Yields comma-separated output with fields total, safe and blum, representing the amount of primes recorded of each type in the database. Additional filtering is possible by setting the fields min_bits, max_bits, submitter, start_date, end_date. An explanation for their intended values can be found below.
  • POST /sophie-germain/submit?prime=...&submitter=... - Submits a prime number to the database. The number is checked for validity and additional conditions (like Safe or Blum primes). Only 1000 hourly failed/duplicate requests to this end-point are allowed.
  • GET /sophie-germain/get - Queries the database. Always returns a comma-separated pair of numbers where the first one is the ID, and the second one is the prime number. The optional parameter id allows retreiving a prime number by its ID; by default a random prime number that satisfies the criteria is returned. The parameters min_bits and max_bits specify the requested size of the prime number. Additional constraints may be placed using the flags safe and blum - by setting them to true. The date of submission can be constrained via start_date and end_date (UTC UNIX timestamps). submitter allows filtering by a specific submitter handle.
Abuse of the API will result in a permanent ban of the IP address from the service.
Submit a Prime Number






Query Primes




















Count Primes















Statistics
Histogram of Recorded Sophie Germain Primes
Fetching data...
Fetching data...
News
  • 29-05-2025: Exhaustive search started for all 32-bit Sophie Germain primes. They are being inserted into the database. So far, all 27-bit primes have been inserted.
  • 30-05-2025: All 32-bit primes have been inserted. A better storage option is being actively sought.