Next Article in Journal
Analysis of a Model of Leishmaniasis with Multiple Time Lags in All Populations
Previous Article in Journal
Functional Ca2+ Channels between Channel Clusters are Necessary for the Propagation of IP3R-Mediated Ca2+ Waves
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Fast Factorisation of Semi-Primes Using Sum of Squares

by
Anthony Overmars
and
Sitalakshmi Venkatraman
*
Department of Information Technology, Melbourne Polytechnic, Preston 3072, Australia
*
Author to whom correspondence should be addressed.
Math. Comput. Appl. 2019, 24(2), 62; https://doi.org/10.3390/mca24020062
Submission received: 16 May 2019 / Revised: 1 June 2019 / Accepted: 2 June 2019 / Published: 11 June 2019

Abstract

:
For several centuries, prime factorisation of large numbers has drawn much attention due its practical applications and the associated challenges. In computing applications, encryption algorithms such as the Rivest–Shamir–Adleman (RSA) cryptosystems are widely used for information security, where the keys (public and private) of the encryption code are represented using large prime factors. Since prime factorisation of large numbers is extremely hard, RSA cryptosystems take advantage of this property to ensure information security. A semi-prime being, a product of two prime numbers, has wide applications in RSA algorithms and pseudo number generators. In this paper, we consider a semi-prime number whose construction consists of primes, N = p 1 p 2 , being Pythagorean and having a representation on the Cartesian plane such that, p = x 2 + y 2 . We prove that the product of two such primes can be represented as the sum of four squares, and further, that the sums of two squares can be derived. For such a semi-prime, if the original construction is unknown and the sum of four squares is known, by Euler’s factorisation the original construction p 1 p 2 can be found. By considering the parity of each of the squares, we propose a new method of factorisation of semi-primes. Our factorisation method provides a faster alternative to Euler’s method by exploiting the relationship between the four squares. The correctness of the new factorisation method is established with mathematical proofs and its practical value is demonstrated by generating RSA-768 efficiently.

1. Introduction

Several mathematicians, since the work of Euclid, have been trying to uncover the mysteries behind prime numbers as they have a unique property of being divisible only by themselves and one [1,2]. The use of large prime numbers in providing information security in this digital age has triggered much research in this direction. With the advent of Rivest–Shamir–Adleman (RSA) encryption system in 1978, prime numbers are being combined innovatively to create cryptographic keys to allow secure transmission of private and sensitive information over computer networks [3,4]. Higher security can be enforced with larger prime numbers since prime factorisation is extremely hard and the RSA system takes advantage of this elegant property [5,6]. However, using very large prime numbers for RSA involves more computational time in encrypting and decrypting the information, which needs to be balanced for real-time applications. With this limitation, malicious attacks target on breaking the RSA system by finding efficient methods of prime factorisation [7,8].
Another advancement in this digital age is the evolution of the Internet of Things (IoT) that connects intelligent devices to work together in providing new personalised capabilities of products and services. However, the IoT has limited computing capabilities, storage and connectivity. In this context, the greatest challenge is in securing IoT devices as well as the confidential communication of information over the IoT network [9]. In such an environment, the cryptographic algorithms are appropriately scaled down and the smaller prime numbers used in the encryption keys can provide more scope for hackers to perform their attacks [10]. Implementing information security capabilities involves several approaches to protect confidential data such as: (i) off-chip cryptographic memories to store sensitive information, (ii) cryptosystems such as symmetric and asymmetric cryptography, and (iii) hardware-level authentication of peripherals. In many situations, efficient and faster prime factorisation method facilitates in breaking the security algorithm in real-time, which serves as a test for establishing the security limits of the computing systems from any possible attack.
In recent years, several prime factorisation methods have been proposed, improving their efficiency to factor composite prime numbers (semi-primes) as large as 250 decimal digits utilising sufficiently large computing power [11,12]. However, semi-prime factorisation still remains a challenge that draws interest from the perspective of research in computational number theory as well as the practical difficulty of cracking RSA keys used in cryptosystems [13,14].
In this paper, we consider the application of prime factorisation for testing the security of RSA cryptography, which is based on a positive integer N, where the encryption and decryption of any message using a pair of public and private keys depends on N. In the RSA algorithm, N is a product of two prime numbers ( N = p 1 p 2 ) and is a semi-prime [15]. In the secured transmission of a message, p 1 and p 2 are employed in RSA to generate the key pairs for encryption and decryption. If p 1 and p 2 are known, then the cracking of the RSA keys becomes possible [16]. Hence, the security of RSA depends on how difficult the factorisation of N is. This motivates research works to propose new factorisation methods. Euler’s factorisation is the most popular method that is well suited for finding prime factors of semi-primes whose constructions are based on Pythagorean primes [17]. We identify the limitations of Euler’s method as it is applicable to only semi-prime constructs that are Pythagorean primes. Our aim in this paper is to propose an improved method by considering the parity of the squares approach. We provide a proof theory that our proposed method requires much fewer steps for the factorisation process of RSA modulus N. Hence, our enhanced method could be applied to test for factorisation attacks that would provide insights into choosing the key size and the time period until which an RSA-based public key algorithm is safe from an attack.

2. Theory and Proposed Method

The definition of a generic Pythagorean triple is denoted as the triple:
( a ,   b ,   c )
where a ,   b ,   c N \ { 0 } , with c > max { a , b } , i.e., a and b denote the sides of a right triangle, and c denotes the length of the hypothenuse [18]. From the fundamental property of right-angled triangles, we have, a 2 + b 2 = c 2 which is among the Diophantine equations [19]. The set of all Pythagorean triples is denoted by P.
For every m ,   n N \ { 0 } , with the series of odd and even Pythagorean triples defined in terms of m and n, it has been proved in previous work by Overmars et al. [17] that:
a = ( 2 m + n 1 ) 2 n 2 b = 2   ( 2 m + n 1 )   n c = ( 2 m + n 1 ) 2 + n 2 .
The above is referred to as the Overmars triangles, and we are interested in the properties of the hypotenuse of the triangle in this paper. As commonly represented, let us denote the hypotenuse in this paper by N , which could be represented as N = ( 2 m + n 1 ) 2 + n 2 . From this equation, if n is odd, then n 2 is also odd and it follows that 2 m + n 1 will be even and ( 2 m + n 1 ) 2 will also be even. Conversely, if n is even, n 2 will be even and both 2 m + n 1 and ( 2 m + n 1 ) 2 will be odd.
Fermat’s Christmas theorem [20] showed that for a Pythagorean prime p 1   m o d   4 = x 2 + y 2 . This was extended by Overmars [19] taking into consideration the parity of x and y such that x 2 + y 2 = ( 2 m + n 1 ) 2 + n 2 , noting that for a particular Pythagorean triangle, the sides making up the hypotenuse where opposite in parity. For a semi-prime consisting of two such triangles whose hypotenuse are prime, it will be shown here that its two sums of two squares will have the following parity:
N = p 1 p 2 = o d d 1 2 + e v e n 1 2 = o d d 2 2 + e v e n 2 2 .
If we consider the following differences:
Δ o = o d d 1 o d d 2   ,   Δ e = e v e n 1 e v e n 2 ,   and   g = gcd ( Δ o , Δ e ) .
It can be shown that one of the primes p 2 can be represented as:
p 2 = ( Δ o g ) 2 + ( Δ e g ) 2 ,   p 1 = N p 2 .
Euler’s factorisation method is suited to semi-primes whose construction are prime factors that are said to be Pythagorean [21,22] and can further be improved upon by considering the parity of the squares. The limitations of this method pertain only to semi-prime constructs that are Pythagorean primes ( p = 1   m o d   4 ). It can also be shown (Section 3) that the combinations of Pythagorean primes with Gaussian primes cannot be represented as the sum of two squares. The implication here is that if the semi-prime construction selects Pythagorean and/or Gaussian primes randomly, only one quarter of the semi-prime constructions avail themselves to this factorisation method. The distribution of Pythagorean and Gaussian primes appear in the set of natural numbers with equal probability. A comprehensive description on the Pythagorean and Gaussian primes and their probabilistic distributions are provided by Oliver Knill [23].
Consider a semi-prime number whose construction consists of primes p 1 ,   p 2 with N = p 1 p 2 , being Pythagorean, and having a representation on the Cartesian plane such that, p = x 2 + y 2 . It can easily be shown that the product of two such primes can be represented as the sum of four squares from which two sums of two squares can be derived. For such a semi-prime, if the original construction is unknown and the sum of four squares is known, the original construction p 1 , p 2 can be found. This paper considers the sum of four squares from which two sums of squares is determined, and hence by Euler’s factorisation the original construction p 1 p 2 can be found. By considering the parity of each of the squares, a new way of determining the semi-prime construction is described. Our proposed method provides an alternative to Euler and uses Overmars triangles. This exploits the relationship between the four squares, from which the two sums of two squares can be determined by considering each squares’ parity, and thereby the factorisation is determined. We describe the Euler’s factorisation forming the foundation of our proposed method and the related proofs in the next two sections of the paper.

3. Euler’s Factorisation Method

We begin by considering Gaussian primes and Pythagorean primes. From the literature, Gaussian primes are of the form [24,25]:
4 x 1 3   m o d   4 ,
and Pythagorean primes of the form:
4 x + 1 3   m o d   4 .
According to Fermat’s Christmas theorem on the sum of two squares, we have the following:
an   odd   prime   p = x 2 + y 2   if   p 1   m o d   4 .
Gaussian primes are of the form p 3   m o d   4 and are not representable as the sum of two squares.
Proposition: 
A semi-prime whose prime factors are Pythagorean can be expressed as the sum of four squares, from which two sums of squares can be derived.
Lemma: 
A semi-prime N = p 1 p 2 , p 1 = a 2 + b 2 , p 2 = c 2 + d 2 is expressed as the sum of four squares, such that:
N = p 1 p 2 = ( a 2 + b 2 ) ( c 2 + d 2 ) = ( a c ) 2 + ( b c ) 2 + ( a d ) 2 + ( b d ) 2 .
Proof: 
Euler’s factorisation
Let us consider the method of Euler’s factorization, where a number (N) can be factored by writing it as a sum of two squares in two different ways as follows:
N = r 2 + s 2 = t 2 + u 2 r 2 t 2 = u 2 s 2 ( r t ) ( r + t ) = ( u s ) ( u + s ) p 1 = ( g c d ( r t , u s ) 2 ) 2 + ( g c d ( r + t , u + s ) 2 ) 2 , p 2 = ( g c d ( r + t ,   u s ) 2 ) 2 + ( g c d ( r t ,   u + s ) 2 ) 2
Let us consider the example N = 2137458620009 to find p 1 and p 2 , using the sum of squares as follows:
N = 3244032 + 14255602 = 6436032 + 13127202,
combining even and odds we get:
1425560 2 1312720 2 = 643603 2 324403 2 a 2 c 2 = d 2 b 2 ( a c ) ( a + c ) = ( d b ) ( d + b ) = ( 968006 )   ( 319200 ) = ( 2738280 )   ( 112840 ) ,
using the greatest common divisor (gcd):
g c d ( a c ,   d b   ) 2 = g c d ( 968006 ,   2738280 ) 2 = 1201 , g c d ( a + c ,   d + b ) 2 = g c d ( 319200 , 112840 ) 2 = 140 , p 1 = 1201 2 + 140 2 = 1462001 g c d ( a + c , d b ) 2 = g c d ( 319200 ,   2738280 ) 2 = 1140 , g c d ( a c ,   d + b ) 2 = g c d ( 968006 , 112840 ) 2 = 403 , p 2 = 1140 2 + 403 2 = 1462009 .
The above example illustrates how the semi-primes of N can be derived as the sum of two squares using Euler’s factorisation method.
Now, express the sum of four squares as two sums of two squares.
Let r = a d + b c ,   s = b d a c ,   t = a c + b d ,   u = a d b c r 2 = ( a d ) 2 + 2 a b c d + ( b c ) 2 ,   s 2 = ( a c ) 2 2 a b c d + ( b d ) 2 , t 2 = ( a c ) 2 + 2 a b c d + ( b d ) 2 ,   u 2 = ( a d ) 2 2 a b c d + ( b c ) 2 r 2 + s 2 = ( a c ) 2 + ( a d ) 2 + ( b c ) 2 + ( b d ) 2 = t 2 + u 2
N = p 1 p 2 = ( a 2 + b 2 ) ( c 2 + d 2 )
N = ( ac ) 2 + ( b c ) 2 + ( a d ) 2 + ( b d ) 2
N = ( a d + b c ) 2 + ( b d a c ) 2 = ( a d b c ) 2 + ( b d + a c ) 2

4. Proposed Semi-Prime Factorisation Using Sum of Squares

Overmars et al. [17] showed that all Pythagorean triples could be represented as N = n 2 + ( n + 2 m 1 ) 2 . If the semi-prime is constructed using two Pythagorean primes ( 4 x + 1 ) then two representations as the sum of two squares can be found and Euler’s factorisation method can be applied. Finding these two representations is non-trivial and computationally intensive for large numbers even with computers with a high performance central processing unit (CPU). The equation N ( m , n ) = n 2 + ( n + 2 m 1 ) 2 provides an elegant search using increments of n and fine convergence using m , and the CPU-intensive square root can be avoided. In this way n is incremented and m is decremented about N to find one of the two solutions along the diagonal of a field of N ( m , n ) N . It can also be shown (as a future work) that once one sum of the squares is known, this can be used to find the other.
Consider the example of a large number, N = 2137458620009 .
N ( m 1 , n 1 ) = n 1 2 + ( n 1 + 2 m 1 1 ) 2 = 324403 2 + ( 324403 + 2 ( 550579 ) 1 ) 2 = 324403 2 + 1425560 2
N ( m 2 , n 2 ) = n 2 2 + ( n 2 + 2 m 2 1 ) 2 = 643603 2 + ( 643603 + 2 ( 334559 ) 1 ) 2 = 643603 2 + 1312720 2
N 1 ( 324403 , 550579 ) = N 2 ( 643603 , 334559 ) = 2137458620009 .
For completeness, N can be represented as two Pythagorean triangles as shown [2]:
Δ ( m ,   n ) = Δ ( a ,   b ,   c ) a ( m , n ) = 2 n ( n + 2 m 1 ) , b ( m , n ) = ( 2 m 1 ) ( 2 n + 2 m 1 ) , c ( m . n ) = n 2 + ( n + 2 m 1 ) 2 Δ ( m 1 , n 1 ) = Δ ( a 1 , b 1 , c 1 ) : Δ ( 324403 ,   550579 ) = Δ ( 28197495801360 ,   8357740887191 ,   29410042540009 ) Δ ( m 2 , n 2 ) = Δ ( a 2 , b 2 , c 2 ) : Δ ( 643603 , 334559 ) = Δ ( 1689741060320 ,   1309008976791 ,   29410042540009 ) .
Once the two sums of two squares have been found, Euler’s factorisation method can be used. N : N = p 1 p 2 .

5. Proposed Method Using Gaussian and Pythagorean Primes

According to Fermat’s Christmas theorem, if Pythagorean primes ( 4 x + 1 4 x 3 ) are used to construct a composite of the semi-prime number ( N ), a solution exists as two sums of two squares. However, if N is constructed using Gaussian primes ( 4 x 1 4 x + 3 ), then Euler’s sum of two squares method cannot be used [26,27]. There is a lack of research in this direction [28,29]. This motivates us to investigate in this paper, if there is a test case which we can use to see if a composite of the semi-prime number has been constructed using Pythagorean primes.
Consider the following composite constructions:
(i)
N = ( 4 x + 1 ) ( 4 y + 1 ) using Pythagorean primes;
(ii)
N = ( 4 x 1 ) ( 4 y 1 ) using Gaussian primes;
(iii)
N = ( 4 x + 1 ) ( 4 y 1 )   or   ( 4 x 1 ) ( 4 y + 1 ) using mixed Pythagorean and Gaussian primes.
(i) Pythagorean prime construction
N = ( 4 x + 1 ) ( 4 y + 1 ) = 16 x y + 4 ( x + y ) + 1 .
We have verified that two sums of two squares representations exist and Euler’s factorisation can be used.
1 N   m o d   4 .
As an illustration, consider the following example for N = 793 .
793 = 10 2 + 12 2 + 15 2 + 18 2 = 13 61 = 3 2 + 28 2 = 8 2 + 27 2 .
Note the parity of the sum of four squares is (odd, even, even, even).
(ii) Gaussian prime construction
N = ( 4 x 1 ) ( 4 y 1 ) = 16 x y 4 ( x + y ) + 1 4 m 3 4 n + 1 .
Sums of three squares exist 1 N   m o d   4 .
As an illustration, consider the following example for N = 649 .
649 = 11 × 59 = 1 2 + 18 2 + 18 2 = 3 2 + 8 2 + 24 2 = 6 2 + 17 2 + 18 2 = 8 2 + 12 2 + 21 2 = 10 2 + 15 2 + 18 2 = 12 2 + 12 2 + 19 2 .
(iii) Mixed Pythagorean-Gaussian prime construction
1 N   m o d   4 .
N = ( 4 x + 1 ) ( 4 y 1 ) = 16 x y 4 ( x y ) 1 , N = ( 4 x 1 ) ( 4 y + 1 ) = 16 x y + 4 ( x y ) 1 .
Sums of four squares exist.
3 N   m o d   4 .
13 × 59 = 767
= 1 2 + 1 2 + 6 2 + 27 2 = 1 2 + 1 2 + 18 2 + 21 2 = 1 2 + 3 2 + 9 2 + 26 2 = 1 2 + 6 2 + 17 2 + 21 2 = 1 2 + 9 2 + 18 2 + 19 2 = 1 2 + 10 2 + 15 2 + 21 2 = 2 2 + 3 2 + 5 2 + 27 2 = 2 2 + 3 2 + 15 2 + 23 2 = 3 2 + 6 2 + 19 2 + 19 2 = 3 2 + 7 2 + 15 2 + 22 2 = 3 2 + 11 2 + 14 2 + 21 2 = 5 2 + 6 2 + 9 2 + 25 2 = 6 2 + 9 2 + 11 2 + 23 2 = 6 2 + 9 2 + 17 2 + 19 2 = 6 2 + 11 2 + 13 2 + 21 2 = 7 2 + 9 2 + 14 2 + 21 2 = 7 2 + 13 2 + 15 2 + 18 2 = 9 2 + 9 2 + 11 2 + 22 2 = 9 2 + 10 2 + 15 2 + 19 2 = 11 2 + 14 2 + 15 2 + 15 2 .
Note the parity of the sum of four squares is (even, odd, odd, odd).
In summary, a semi-prime whose composite construction is based upon both Pythagorean and Gaussian primes can easily be identified when N   m o d   4 3 is true and the sum of four squares parity is (even, odd, odd, odd) and Euler’s factorisation cannot be used. Table 1 provides possible composite constructs of a semi-prime number using Pythagorean and Gaussian primes as the factors. When P   m o d   4 1 is true, the composite could be constructed using Pythagorean primes or Gaussian primes. When the Pythagorean construct is confirmed, we can verify that: (i) the sum of four squares parity is (odd, even, even, even), (ii) the two sums of two squares can be found, and (iii) Euler’s factorisation can be employed.
Proof: 
Let N be a semi-prime and p 1 and p 2 are its two prime factors so that N = p 1 p 2 . Assume also that p 1 and p 2 are distinct. Suppose that the primes p 1 and p 2 are “Pythagorean” (2-square), that is, they can each be written as the sum of two squares of natural numbers: p 1 = a 2 + b 2 , p 2 = c 2 + d 2 , then:
N = p 1 p 2 = ( a 2 + b 2 ) ( c 2 + d 2 ) = a 2 c 2 + a 2 d 2 + b 2 c 2 + b 2 d 2 N = a 2 c 2 + 2 a b c d + b 2 d 2 + a 2 d 2 2 a b c d + b 2 c 2 = a 2 d 2 + 2 a b c d + b 2 c 2 + a 2 c 2 2 a b c d + b 2 d 2 = ( a c + b d ) 2 + ( a d b c ) 2 = ( a d + b c ) 2 + ( a c b d ) 2   = t 2 + u 2 = r 2 + s 2 .
Therefore, N is also Pythagorean, and can be represented as the sum of two squares in two different ways:
r = a d + b c   ,   s = a c b d   , t = a c + b d ,   u = a d b c .
The problem is rephrased as:
Given N = r 2 + s 2 = t 2 + u 2 , is known. r , s , t , u , N \ { 0 } . Find p 1 and p 2 .
s + t = 2 a c ,   r + u = 2 a d , g = gcd ( s + t , r + u ) = gcd ( 2 a c , 2 a d ) = 2 a s + t g = 2 a c 2 a = c ,   r + u g = 2 a d 2 a = d   , p 2 = c 2 + d 2 = ( s + t g ) 2 + ( r + u g ) 2 = ( s + t ) 2 + ( r + u ) 2 g 2
then the factors of N are:
p 2 = c 2 + d 2 = ( s + t g ) 2 + ( r + u g ) 2 , p 1 = N p 2

6. Verification with Ordering Ambiguity

In this section, we verify that the ordering of the odd and even pairs does not affect the results.
Consider the following example 1 of ordering of odd and even pairs as follows:
1000009 = 1000 2 + 3 2 = 972 2 + 235 2 ,
a = 1000 ,   b = 3 ,   c = 972 ,   d = 235
g = g c d ( 1000 + 972 ,   235 + 3 ) = 34 ,
x 1 = 1972 / 34 = 58 ,   y 1 = 238 / 34 = 7
p 2 = 58 2 + 7 2 = 3413 .
Consider the following example 2 of ordering of odd and even pairs as follows:
1000009   = 1000 2 + 3 2 = 235 2 + 972 2 ,
a = 1000 ,   b = 3 ,   c = 235 ,   d = 972 ,
g = g c d ( 1000 + 235 ,   972 + 3 ) = 65 ,
x 1 = 1235 / 65 = 19 ,   y 1 = 975 / 65 = 15 ,
p 1 = 19 2 + 15 2   = 586   =   2 293 .
Furthermore, we have additional information which can assist in removing this ambiguity. If we consider odd and even pairs when ordering the sums, we can use Overmars triangles to conserve parity and remove this ambiguity.
Consider the following form:
p = a 2 + b 2 = ( 2 m + n 1 ) 2 + n 2 , a = 2 m + n 1 ,   b = n .
When n = o d d ,   2 m + n 1 = e v e n a   i s   e v e n ,   b   i s   o d d .
Conversely, n = e v e n ,   2 m + n 1 = o d d a   i s   o d d ,   b   i s   e v e n .
Odd/even or even/odd parity is thus assured and preserved for each of the sums of squares and this additional information can be used to remove the ordering ambiguity.
Consider the difference between odd and even parts of the two sums of two squares, this removes the ordering ambiguity:
Δ o = o d d 1 o d d 2 , Δ e = e v e n 1 e v e n 2 , g = gcd ( Δ o , Δ e ) ,
one of the primes p 2 can be given as:
p 2 = ( Δ o g ) 2 + ( Δ e g ) 2 Δ o = | 3 235 | = 232 , Δ e = | 1000 972 | = 28 , g = gcd ( 232 , 28 ) = 4 , p 2 = ( 232 4 ) 2 + ( 28 4 ) 2 = 58 2 + 7 2 = 3413 .
Proof: 
Express p 1 ,   p 2 as Overmars triangles.
p 1 = a 2 + b 2 = ( 2 m 1 + n 1 1 ) 2 + n 1 2 , p 2 = c 2 + d 2 = ( 2 m 2 + n 2 1 ) 2 + n 2 2
N = p 1 p 2 = ( a 2 + b 2 ) ( c 2 + d 2 ) = ( ( 2 m 1 + n 1 1 ) 2 + n 1 2 ) ( ( 2 m 2 + n 2 1 ) 2 + n 2 2 ) = ( a c ) 2 + ( b d ) 2 + ( a d ) 2 + ( b c ) 2 = ( ( 2 m 1 + n 1 1 ) ( 2 m 2 + n 2 1 ) ) 2 + ( n 1 n 2 ) 2 + ( ( 2 m 1 + n 1 1 ) n 2 ) 2 + ( n 1 ( 2 m 2 + n 2 1 ) ) 2
N = ( a c + b d ) 2 + ( a d b c ) 2 = s 2 + t 2 = ( ( 2 m 1 + n 1 1 ) ( 2 m 2 + n 2 1 ) + n 1 n 2 ) 2 + ( ( 2 m 1 + n 1 1 ) n 2 n 1 ( 2 m 2 + n 2 1 ) ) 2 = ( a d + b c ) 2 + ( a c b d ) 2 = u 2 + r 2 = ( ( 2 m 1 + n 1 1 ) n 2 + n 1 ( 2 m 2 + n 2 1 ) ) 2 + ( ( 2 m 1 + n 1 1 ) ( 2 m 2 + n 2 1 ) n 1 n 2 ) 2 .
Let us express two semi-primes N 1 ,   N 2 as Overmars triangles as follows:
N 1 = s 2 + t 2 = ( 2 v + t 1 ) 2 + t 2 , N 2 = u 2 + r 2 = ( 2 w + r 1 ) 2 + r 2 ,
where v = s t + 1 2 ,   w = u r + 1 2 .
Substitute for v ,   t ,   w , r ,
  • N 1 = s 2 + t 2 = ( 2 v + t 1 ) 2 + t 2 ,
  • v = 2 m 1 m 2 m 1 + 2 n 1 m 2 + n 1 n 2 n 1 m 2 + 1 ,
  • t = 2 m 1 m 2 2 n 1 m 2 + n 1 n 2 ,
  • N 2 = u 2 + r 2 = ( 2 w + r 1 ) 2 + r 2 ,
  • r = 4 m 1 m 2 + 2 m 1 n 2 2 m 1 + 2 n 1 m 2 n 1 2 m 2 n 2 + 1 ,
  • w = 2 m 1 m 2 + m 1 + m 2 + n 1 n 2 ,
  • N 1   =   16   m 1 2   m 2 2   +   16   m 1 2   m 2   n 2     16   m 1 2   m 2   +   8   m 1 2   n 2 2     8   m 1 2   n 2   +   4   m 1 2   +   16   m 1   n 1   m 2 2        +   16   m 1   n 1   m 2   n 2     16   m 1   n 1   m 2   +   8   m 1   n 1   n 2 2     8   m 1   n 1 n 2   +   4   m 1   n 1        16   m 1   m 2 2     16   m 1   m 2   n 2   +   16   m 1   m 2     8   m 1   n 2 2   +   8   m 1   n 2     4   m 1   +   8   n 1 2   m 2 2      +   8   n 1 2   m 2   n 2     8   n 1 2   m 2   +   4   n 1 2   n 2 2     4   n 1 2   n 2   +   2   n 1 2     8   n 1   m 2 2     8   n 1   m 2   n 2        +   8   n 1   m 2     4   n 1   n 2 2   +   4   n 1   n 2     2   n 1 +   4   m 2 2   +   4   m 2   n 2     4   m 2   +   2   n 2 2     2   n 2      +   1 ,
  • N 2   =   16   m 1 2   m 2 2   +   16   m 1 2   m 2   n 2     16   m 1 2   m 2   +   8   m 1 2   n 2 2     8   m 1 2   n 2   +   4   m 1 2   +   16   m 1   n 1   m 2 2        +   16   m 1   n 1   m 2   n 2     16   m 1   n 1   m 2   +   8   m 1   n 1   n 2 2     8   m 1   n 1 n 2   +   4   m 1   n 1          16   m 1   m 2 2     16   m 1   m 2   n 2   +   16   m 1   m 2     8   m 1   n 2 2   +   8   m 1   n 2     4   m 1   +   8   n 1 2   m 2 2        +   8   n 1 2   m 2   n 2     8   n 1 2   m 2   +   4   n 1 2   n 2 2     4   n 1 2   n 2   +   2   n 1 2     8   n 1   m 2 2     8   n 1   m 2   n 2        +   8   n 1   m 2     4   n 1   n 2 2   +   4   n 1   n 2     2   n 1 +   4   m 2 2   +   4   m 2   n 2     4   m 2   +   2   n 2 2     2   n 2      +   1 ,
  • N 1 = N 2 =   ( 4   m 1 2   +   4   m 1   n 1     4   m 1   +   2   n 1 2     2   n 1   +   1 ) ( 4   m 2 2   +   4   m 2   n 2     4   m 2   +   2   n 2 2     2   n 2   +   1 )      = [ ( 2   m 1   +   n 1     1 ) 2   +   n 1 2 ] [ ( 2 m 2 + n 2 1 ) 2 + n 2 2 ] ,
  • N 1 = N 2 = p 1 p 2
  •   ⇒   p 1 = ( 2 m 1 + n 1 1 ) 2 + n 1 2   ,
  • p 2 = ( 2 m 2 + n 2 1 ) 2 + n 2 2 .
Recall from Section 2:
N = p 1 p 2 = ( a 2 + b 2 ) ( c 2 + d 2 )
N = ( ac ) 2 + ( b c ) 2 + ( a d ) 2 + ( b d ) 2
N = ( a d + b c ) 2 + ( b d a c ) 2 = ( a d b c ) 2 + ( b d + a c ) 2
Let a = 2 m 1 + n 1 1 ,   b = n 1 ,   c = 2 m 2 + n 2 1   ,   d = n 2 and consider the parities given in Table 2.
From Equation (1) p 2 = c + d , observe from the table the parities, recalling ( b = n 1 ,   d = n 2 ),
p a r i t y ( b ) = p a r i t y ( d ) ,
c = Δ e g ,   d = Δ o g ,   p 2 = ( Δ e g ) 2 + ( Δ o g ) 2
p a r i t y ( b ) p a r i t y ( d ) ,
c = Δ o g ,   d = Δ e g ,   p 2 = ( Δ o g ) 2 + ( Δ e g ) 2
p 2 = ( Δ o g ) 2 + ( Δ e g ) 2
p 2 = ( Δ o g ) 2 + ( Δ e g ) 2 ,
p 1 = N p 2 ,
N = p 1 p 2
= o 1 2 + e 1 2 = o 2 2 + e 2 2 ,
Δ o = o 1 o 2 ,
Δ e = e 1 e 2 ,
g = gcd ( Δ o , Δ e ) .

7. Application of Proposed Method for RSA Factorisation

Historically, an RSA algorithm was experimentally tested using brute force attacks by trying all possible secret keys (public and private keys). When RSA employed shorter keys for encryption and decryption, they became easier to identify using brute force attacks [15]. Larger keys could escape from brute force attacks since they are exponentially more difficult to crack and hence, the key length is an indicator of how a brute force attack is practically feasible. Therefore, the strength of an RSA cryptosystem is measured theoretically by determining how many steps it would take for a brute force attack to crack the keys. However, with greater computations involved with larger keys, and as the encryption and decryption algorithm takes much larger time, there is a limitation on the key length used for practical applications. Hence, different factoring algorithms and faster cryptosystems have been researched [29,30,31]. Different implementations of the modular exponentiation have resulted in the timing variations of the attacks used for performing an RSA attack. In other words, for an encrypted message or cipher text C , it is the ability to find d by determining the time taken to compute C d ( m o d   N ) .
Another method is to perform factorisation attacks mathematically by factoring the modulus N , which forms the underlying structure of an RSA function [15]. While there are several factorisation approaches, the common goal is to factor the semi-prime, N = p 1 p 2 . The encryption algorithm selects the secret keys p 1 and p 2 to calculate the public key N = p 1 p 2 . The decryption algorithm then factors N to obtain the keys p 1 and p 2 . Hence, new factorisation algorithms have been mathematically derived in generating public and private keys of an RSA algorithm, however, they take a long period of time for the factorisation of N when the keys p 1 and p 2 are very large. The first RSA number successfully generated in 1991 was RSA-100 and subsequently up to RSA-500. They were labeled according to their key size, namely number of decimal digits occupied when implemented in the computer. While factorisation of RSA-617 was successful before RSA-576, many of the bigger numbers have still not been factored. Hence, the factoring challenge was introduced to give an insight into which key length is safe and for how long so that applications could choose the key length for their RSA encryption algorithm ensuring security until it is proven to be safe. This forms the motivation for researchers to mathematically prove RSA factorisation time limits that help in the understanding of the cryptanalytic strength of commonly adopted cryptosystems in practice. Hence, in this paper, we focus on proposing a new factorisation method that is efficient in terms of the speed of factorisation. We demonstrate the application of our proposed factorisation method for RSA-768 as shown in Table 3.
In general, the computational complexity of a factorisation algorithm can be measured by the number of operations it performs [32]. Factorisation algorithms are also interesting from the computational complexity viewpoint. Since the existing algorithms are not able to solve the factoring problem in polynomial time, encryption keys are developed as they cannot be factored in a reasonable amount of computer time [33]. Overall, our proposed factorisation method provides a faster alternative to the commonly used modulus exponentiation methods and Euler’s method, by exploiting the relationship between the four squares. The implementation of our method requires a constant amount of clock cycles for completing such simple arithmetic operations and hence requires a reduced computational complexity. The mathematical proof of our new factorisation method and its demonstration for generating RSA-768 have been established. Many of the bigger prime numbers are yet to be factored and are expected to remain unfactored for quite some time. However, such beliefs can be challenged when new factorisation techniques and new technologies are introduced. Since encryption schemes are being used today to protect financial and other confidential data, ways and means of developing a single quantum computer to factor very large primes quickly and in parallel are under consideration. Shor’s quantum algorithm developed in 1994 depends on a computer with a large number of quantum bits to calculate the prime factors of a large number. A large prime number, with even 232 digits, could take more than two years to factor using hundreds of computers working in parallel. Hence, a major breakthrough in technologies such as quantum computers along with the innovation of Shor’s algorithm and other work, including ours, could make this problem domain an interesting space for academic researchers and industry practitioners to explore further.

8. Conclusions and Future Work

In this paper, we proposed a new method for semi-prime factorisation which forms a cornerstone for security in RSA cryptosystems. By exploiting the relationship between a set of four squares, we provide a relatively simple, fast and scalable factorisation method that is computationally more efficient than the existing, commonly used modulus exponentiation methods and Euler’s method. The mathematical proofs behind the development of our simple and reliable algorithm for semi-prime factorisation were presented. In addition, the application of our method to factorise large semi-primes for generating RSA-768 was established.
Our work in this paper forms the backbone in creating new research opportunities. With new technologies such as IoT, blockchain and quantum computers evolving, future work would involve exploring our factorisation method in various cryptographic protocols within such new computing paradigms.

Author Contributions

Conceptualization, A.O. and S.V.; methodology, A.O.; validation, A.O.; resources, S.V.; data curation, A.O.; writing—original draft preparation, A.O.; writing—review and editing, S.V.

Funding

This research received no external funding.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Goldston, D.A.; Graham, S.; Pintz, J.; Yildirim, C.Y. Small gaps between primes or almost primes. Trans. Am. Math. Soc. 2009, 361, 5285–5330. [Google Scholar] [CrossRef]
  2. Kaddoura, I.; Abdul-Nabi, S. On formula to compute primes and the nth prime. Appl. Math. Sci. 2012, 6, 3751–3757. [Google Scholar]
  3. Rivest, R.L.; Shamir, A.; Adleman, L. A method for obtaining digital signatures and public-key cryptosystems. Commun. Acm 1978, 21, 120–126. [Google Scholar] [CrossRef]
  4. Rescorla, E. SSL and TLS: Designing and Building Secure Systems; Addison-Wesley: Reading, UK, 2001. [Google Scholar]
  5. Sun, H.M.; Wu, M.E.; Ting, W.C.; Hinek, M.J. Dual RSA and its Security Analysis. IEEE Trans. Inf. Theory 2007, 53, 2922–2933. [Google Scholar]
  6. Schneier, B. Applied Cryptography, 2nd ed.; John Wiley & Sons, Inc.: New York, NY, USA, 1996. [Google Scholar]
  7. Clark, J.; van Oorschot, P.C. SoK: SSL and HTTPS: Revisiting past challenges and evaluating certificate trust model enhancements. In Proceedings of the 2013 IEEE Symposium on Security and Privacy (SP), Berkeley, CA, USA, 19–22 May 2013; pp. 511–525. [Google Scholar]
  8. Aboud, S.J. An efficient method for attack RSA scheme. In Proceedings of the ICADIWT 2nd International Conference, London, UK, 4–6 August 2009; pp. 587–591. [Google Scholar]
  9. Suárez-Albela, M.; Fraga-Lamas, P.; Fernández-Caramés, T.M. A Practical Evaluation on RSA and ECC-Based Cipher Suites for IoT High-Security Energy-Efficient Fog and Mist Computing Devices. Sensors 2018, 18, 3868. [Google Scholar] [CrossRef] [PubMed]
  10. Sen, S.; Koo, J.; Bagchi, S. TRIFECTA: Security, Energy Efficiency, and Communication Capacity Comparison for Wireless IoT Devices. IEEE Internet Comput. 2018, 22, 74–81. [Google Scholar] [CrossRef] [Green Version]
  11. Da Silva, J.C.L. Factoring Semi primes and Possible Implications. In Proceedings of the 26th IEEE Convention in Israel, Eliat, Israel, 17–20 November 2010; pp. 182–183. [Google Scholar]
  12. Yamagishi, S. Diophantine equations in semiprimes. arXiv 2017, arXiv:1709.03605. [Google Scholar]
  13. Weisstein, E.W. Semiprime; Wolfram Research, Inc.: Champaign, IL, USA, 2003. [Google Scholar]
  14. Kaddoura, I.; Abdul-Nabi, S.; Al-Akhrass, K. New Formulas for Semi-Primes. Testing, Counting and Identification of the nth and next Semi-Primes. arXiv 2016, arXiv:1608.05405. [Google Scholar]
  15. Ambedkar, B.R.; Bedi, S.S. A New Factorization Method to Factorize RSA Public Key Encryption. Int. J. Comput. Sci. Issues (IJCSI) 2011, 8, 242–247. [Google Scholar]
  16. Yan, S.Y. Factoring Based Cryptography. In Cyber cryptography: Applicable Cryptography for Cyberspace Security; Springer: Berlin/Heidelberg, Germany, 2018; pp. 217–286. [Google Scholar] [CrossRef]
  17. Overmars, A.; Ntogramatzidis, L.; Venkatraman, S. A new approach to generate all Pythagorean triples. AIMS Math. 2019, 4, 242–253. [Google Scholar] [CrossRef]
  18. Overmars, A.; Venkatraman, S. Pythagorean-Platonic lattice method for finding all co-prime right angle triangles. Int. J. Comput. Inf. Eng. 2017, 11, 1192–1195. [Google Scholar]
  19. Overmars, A.; Ntogramatzidis, L. A new parameterisation of Pythagorean triples in terms of odd and even series. arXiv 2015, arXiv:1504.03163. [Google Scholar]
  20. Bell, E.T. The Prince of Amateurs: Fermat; Simon and Schuster: New York, NY, USA, 1986; pp. 56–72. [Google Scholar]
  21. Hiary, G.A. A Deterministic Algorithm for Integer Factorization. Math. Comput. 2016, 85, 2065–2069. [Google Scholar] [CrossRef]
  22. Malapert, A.; Provillard, J. Puzzle—Solving the n-Fractions Puzzle as a Constraint Programming Problem. INFORMS Trans. Educ. 2018, 19, 48–55. [Google Scholar] [CrossRef]
  23. Knill, O. Some experiments in number theory. arXiv 2016, arXiv:1606.05971. [Google Scholar]
  24. Pollard, J. Monte Carlo methods for index computation (mod p). Math. Comput. 1978, 32, 918–924. [Google Scholar]
  25. Kostopoulos, G. An Original Numerical Factorization Algorithm. J. Inf. Assur. Cyber Secur. 2016, 2016, 775081. [Google Scholar] [CrossRef]
  26. Pollard, J. Theorems on factorization and primality testing. Proc. Camb. Philos. Soc. 1974, 76, 521–528. [Google Scholar] [CrossRef]
  27. McKee, J. Turning Euler’s factoring method into a factoring algorithm. Bull. Lond. Math. Soc. 1996, 28, 351–355. [Google Scholar] [CrossRef]
  28. Scripcariu, L.; Frunza, M.D. A New Character Encryption Algorithm. In Proceedings of the ICMCS 2005, Montreal, QC, Canada, 14 August 2005; pp. 83–86. [Google Scholar]
  29. Wiener, M. Cryptanalysis of short RSA secret exponents. IEEE Trans. Inf. Theory 1990, 160, 553–558. [Google Scholar] [CrossRef]
  30. McKee, J.; Pinch, R. Old and new deterministic factoring algorithms. Algorithmic Number Theory 2005, 217–224. [Google Scholar] [CrossRef]
  31. Overmars, A.; Venkatraman, S. A new method of golden ratio computation for faster cryptosystems. In Proceedings of the IEEE Cybersecurity and Cyber forensics Conference, London, UK, 21–23 November 2017. [Google Scholar]
  32. Karatsuba, A. The complexity of computations. Proc. Steklov Inst. Math. 1995, 211, 169–183. [Google Scholar]
  33. Traversa, F.L.; di Ventra, M. Polynomial-time solution of prime factorization and NP-complete problems with digital memcomputing machines. Chaos Interdiscip. J. Nonlinear Sci. 2017, 27, 023107. [Google Scholar] [CrossRef] [PubMed] [Green Version]
Table 1. Possible composite constructs using Pythagorean and Gaussian primes.
Table 1. Possible composite constructs using Pythagorean and Gaussian primes.
Composite 4 x 1 4 x + 1 3.15 11 13
4 y 1 16 x y 4 ( x + y ) + 1 16 x y 4 ( x y ) 1 59649767
4 y + 1 16 x y 4 ( y x ) 1 16 x y + 4 ( x + y ) + 1 61 671 793
Table 2. Parity considerations for factorisation.
Table 2. Parity considerations for factorisation.
b d a c a d + b c a c b d a d b c a c + b d Δ o Δ e g Δ o g Δ e g
o o e e e o e o 2 b d 2 b c 2 b d c
e e o o e o e o 2 b d 2 b c 2 b d c
o e e o o e e 2 b c 2 b d 2 b c d
e o o e o e o e 2 b c 2 b d 2 b c d
( o = o d d , e = e v e n )
Table 3. Rivest–Shamir–Adleman (RSA) factorisation (e.g. RSA-768) using the proposed method.
Table 3. Rivest–Shamir–Adleman (RSA) factorisation (e.g. RSA-768) using the proposed method.
Factorisation StepsOutputs
RSA-7681230186684530117755130494958384962720772853569595334792197322452151726400507263657518745202199786469389956474942774063845925192557326303453731548268507917026122142913461670429214311602221240479274737794080665351419597459856902143413
e v e n 1 27352250955639491672938559088489354093745283692298054670410060729734544070401412058040852474743188457278097453971742
o d d 1 21955433318197941448284339595819001813420702779026856093076047024562771910171296992175792528202395940970592960030457
o d d 2 24790170680500776080773612245377234943315153275682177842903274514172846200244317562713076025683541068043396354533177
e v e n 2 24811975378066081010612898468833970017619648217686958124001556260617310771432375603204603028940940647642080934383422
Δ o = o d d 1 o d d 2 2834737362302834632489272649558233129894450496655321749827227489610074290073020570537283497481145127072803394502720
Δ e = e v e n 1 e v e n 2 2540275577573410662325660619655384076125635474611096546408504469117233298969036454836249445802247809636016519588320
g = gcd ( Δ o , Δ e ) 627928153105939350555378446039188539852332233574215955680
Δ o g 4514429474584457604059260685088937606791715198364890782254
Δ e g 4045487632634994038632464260708513408124495115537369857049
p 2 = ( Δ o g ) 2 + ( Δ e g ) 2 36746043666799590428244633799627952632279158164343087642676032283815739666511279233373417143396810270092798736308917
p 1 = N p 2 33478071698956898786044169848212690817704794983713768568912431388982883793878002287614711652531743087737814467999489

Share and Cite

MDPI and ACS Style

Overmars, A.; Venkatraman, S. A Fast Factorisation of Semi-Primes Using Sum of Squares. Math. Comput. Appl. 2019, 24, 62. https://doi.org/10.3390/mca24020062

AMA Style

Overmars A, Venkatraman S. A Fast Factorisation of Semi-Primes Using Sum of Squares. Mathematical and Computational Applications. 2019; 24(2):62. https://doi.org/10.3390/mca24020062

Chicago/Turabian Style

Overmars, Anthony, and Sitalakshmi Venkatraman. 2019. "A Fast Factorisation of Semi-Primes Using Sum of Squares" Mathematical and Computational Applications 24, no. 2: 62. https://doi.org/10.3390/mca24020062

Article Metrics

Back to TopTop