logo

Factorization of Semiprimes: Conditions for Easy Resolution 📂Number Theory

Factorization of Semiprimes: Conditions for Easy Resolution

Theorem 1

The problem of factorizing semiprimes N=pqN = pq becomes relatively easy under the following conditions:

Explanation

The meaning of condition (ii) is that when the difference between pp and qq is small, it becomes easier to solve, which requires explanation:

  • At first glance, if p,qNp,q \in \mathbb{N} is constrained by (p+q)(p + q), the best way to maximize N=pqN = pq is to make the difference between pp and qq as small as possible. For instance, if p+q12p+q \le 12, then pqpq has its maximum value 3535 when 7=pq=57 = p \approx q = 5.

To prevent solving by brute force, both pp and qq should be as large as possible. Suppose N1=347=141N2=1113=143 N_{1}=3 \cdot 47=141 \\ N_{2}=11 \cdot 13=143 is given, then when it is disclosed, the difference is only 22, but N1N_{1} gets solved immediately as the “hard work” begins.

  • However, using pp and qq of similar sizes for this simplistic reason could be cracked by a two-dimensional thinker. Simply put, if really pqp \approx q, an attacker can significantly reduce the candidate solutions near N\sqrt{N} by assuming Np2N \approx p^2. If mathematical techniques are applied in this idea, N=pqN=pq becomes a very easy problem.

Proof

(i)

If pp is a smooth prime, the Pollard p1p-1 factorization algorithm can be used, making the semiprime factorization problem relatively easy to solve.

(ii)

If we set p:=a+bp := a + b, q:=abq := a - b, then pp, qq become primes that are ±b\pm b distance apart centered around aa. Representing this with NN, N=(a+b)(ab)=a2b2 \begin{align*} N =& ( a + b)(a - b) \\ =& a^2 - b^2 \end{align*} which means N+b2=a2N + b^2 = a^2. Thus, by increasing 11 by bb in NN and finding when (N+b2)\left( N + b^2 \right) becomes a square number, we can know what p=a+bp = a + b, q=abq = a - b are, thus making the semiprime factorization problem relatively easy to solve.

Examples

As an example, consider N=25217N = 25217. Directly factorizing NN is not an easy task, but knowing that 25217+82=159225217 + 8^2 = 159^2 allows us to immediately find p=159+8=167q=1598=151 \begin{align*} p =& 159 + 8 = 167 \\ q =& 159-8 = 151 \end{align*} In the context of the text, because it’s 167151167 \approx 151, it got solved easily.

On the other hand, let’s make finding this bb more ingenious. For some kk, kN=a2b2 k N = a^2 - b^2 since (a+b)(a+b) and (ab)(a-b) are multiples of kk, simply dividing both sides by kk gives us the formula for NN directly. The reason for this cumbersome process is because the formula can be represented like this: a2b2(modN) a^2 \equiv b^2 \pmod{N} Following this method, we find d=qd = q next.


Step 1. cic_{i}

For numbers cic_{i} with a low calculation divisor, find a1,,ara_{1} , \cdots , a_{r} that satisfy ciai2(modp)c_{i} \equiv a_{i}^{2} \pmod{p}.


Step 2. b2b^2 Calculation

Find ci1,,cisc_{i_{1}} , \cdots , c_{i_{s}} that satisfy ai1ais=aci1cis=b2 a_{i_{1}} \cdots a_{i_{s}} = a \\ c_{i_{1}} \cdots c_{i_{s}} = b^2


Step 3. d=gcd(N,ab)d = \gcd \left( N , a-b \right)

Using the calculated aa and bb, a2(ai1ais)2ai12ais2ci1cisb2 \begin{align*} a^2 & \equiv \left( a_{i_{1}} \cdots a_{i_{s}} \right)^{2} \\ & \equiv a_{i_{1}}^{2} \cdots a_{i_{s}}^{2} \\ & \equiv c_{i_{1}} \cdots c_{i_{s}} \\ & \equiv b^2 \end{align*} so dd is a divisor of NN, which is qq.

See also

Security algorithms utilizing the difficulty of the factorization problem

Attack algorithms for the factorization problem


  1. Hoffstein. (2008). An Introduction to Mathematical Cryptography: p133~139. ↩︎