Abstract
Fermat’s Factoring Algorithm (FFA) is an integer factorisation methods factoring the modulus N using exhaustive search. The appearance of the Estimated Prime Factor (EPF) method reduces the cost of FFA’s loop count. However, the EPF does not work for balanced primes. This paper proposed the modified Fermat’s Factoring Algorithm 1-Estimated Prime Factor (mFFA1-EPF) that improves the EPF method. The algorithm works for factoring a modulus with unbalanced and balanced primes, respectively. The main results of mFFA1-EPF focused on three criteria: (i) the approach to select good candidates from a list of convergent continued fraction, (ii) the establishment of new potential initial values based on EPF, and (iii) the application of the above modification upon FFA. The resulting study shows the significant improvement that reduces the loop count of FFA1 via (improved) EPF compared to existing methods. The proposed algorithm can be executed without failure and caters for both the modulus N with unbalanced and balanced primes factor. The algorithm works for factoring a modulus with unbalanced and balanced primes.
1. Introduction
Cryptography has its crucial parts in Industrial Revolution 4 (IR4) where technology is embedded in artificial intelligent to maintain the secureness of the information data. Regarding cryptography, there are two types of cryptography: symmetric and asymmetric cryptography. Symmetric cryptography uses the same key for the encryption and decryption process while asymmetric cryptography uses different keys for each encryption and decryption process. A lot of asymmetric cryptography strength relies on the Integer Factorisation Problem (IFP). IFP is one of the oldest hard mathematical problems in history. IFP is defined as finding the two distinct primes, p and q, for a given integer (a modulus) , which is the multiplication of those two primes. We et al. [1] mentioned that from the existing classical sense of computation, a modulus with a minimum 1024-bit length is still very hard to be factorised. There are several general purpose algorithms to solve the IFP, such as Pollard’s , General Number Field Sieve, Quadratic Sieve, Elliptic Curve Factoring, and Fermat’s Factoring Algorithm [2].
Pierre de Fermat explored Fermat’s Factoring Algorithm (FFA) as one of the IFP methods that is used to factor the modulus N with balanced primes (Ambedkar et al. [3]). According to Somsuk and Tientanopajai [4], the modulus N in FFA is written as . In this work, the FFA is categorised into Fermat’s Factoring Algorithm 1 (FFA1) and Fermat’s Factoring Algorithm 2 (FFA2). FFA1 uses a square root, while FFA2 uses multiplication as their main processes that lead to factorization of N. Both methods are having their advantages and disadvantages in terms of the number of loop count (iteration) and computational time to complete the factoring process. Many studies have introduced to improve the FFA, to make the algorithm efficient for factoring the modulus N [5,6,7,8]. The main purpose is to speed up the algorithms: either to reduce the loop count or to improve the algorithm’s computational time for exhaustive search or both [9].
The EPF is introduced by Wu et al. [1]. Wu et al’s study enhances the efficiency of FFA2 by shortening the search for the target value of and . The EPF method was adopted as a mechanism to reset the initial values of FFA (in this case is FFA2), which results in reducing the loop count for the FFA to complete the search and successfully factor the modulus N. The authors of [1,9] use the continued fraction of to produce a list of convergent and create an additional extension for the initial values. Potentially, EPF is considered as a good “device” to increase the efficiency of FFA.
However, as reported in [1], the absence of a deterministic approach to select the required parameter in EPF is the limitations of such an approach, and most of the cases cannot work on balanced primes. Somsuk [5] agreed that EPF works perfectly only on unbalanced primes. By observation and empirical evidence, the selected values on the list of convergent certainly cannot be used for the initial value because it may cause the FFA2 algorithm to fail. On the other hand, the authors of [1] overlook a convergent-selecting case that affects the effectiveness of EPF. In finding a solution regarding EPF, FFA1 is chosen to be the main integer factorisation method in this study. This is because FFA1 potentially avoids the failure of running algorithm via EPF and reduce the exhaustive search as it uses a single loop run the algorithm. The resulting study shows a significant improvement that reduces the loop count of FFA1 via (improved) EPF compared to previous methods (FFA1, FFA2, FFA2-EPF, and FFA-Euler).
The rest of this paper is sorted as follows. Section 2 introduces the background of the FFA1, FFA2, and EPF. The definition of a modulus N is provided considering unbalanced and balanced primes. Section 3 discusses the methodology that will support the finding of this work. Section 4 presents the mFFA1-EPF, which works on factoring a modulus N for both unbalanced and balanced primes. The results of numerical examples are shown and compared with other existing FFA-based method. The conclusion is drawn in Section 5.
2. Preliminaries
Some fundamental information for the study, about FFAs and EPF, and some definitions are provided.
2.1. Balanced and Unbalanced Primes
This section provided the definitions of balanced and unbalanced primes, which restructure from [10,11], respectively. The definition of balanced prime is as follows.
Definition 1.
Let be a number with a multiplication of two primes p and q. The number N is defined to have balanced primes where p and q have the same bit-size and satisfy the relation .
The term of unbalanced primes is defined, as follows.
Definition 2.
Let be a number with a multiplication of two primes p and q. The number N is defined to have unbalanced primes where p and q have the different bit-size and satisfy the relation where .
2.2. Fermat’s Factoring Algorithm (FFA)
De Weger [12] studied FFA1 as an approach of IFP to factor the modulus N by searching the value of and . There is modulus N written as the difference of square, . As the value of and are unknown, we need to find the closest of those values. According to Asbullah and Ariffin [10], the smallest value of , based on balanced prime, is . We start the initial value and then, compute . If y is an integer then we accept the pair . Otherwise, the algorithm is ran by increasing the value of x by 1. If there is a pair of integers (), then compute the values and . Note that FFA1 only run a loop on searching the integer value on via initial value of x.
Bressoud [13] introduced FFA2, which is uses two loops on searching and to reduce the running time. Wu et al. [1] reformulated the Bressoud’s method. Suppose there is modulus where and . The modulus is derived into where and . As the actual values of u and v are unknown, reset and . Now compute . If , thus the solution of is found. There are two cases for value of r as :
- Case 1: WhenThe value of v needs to set larger; and then
- Case 2: WhenThe value of u needs to set larger; and then
When the initial value u and v are created, we need to check the value of r. If , there are two cases: and . If , the new v is produced that is increased by 2 from the old v, then the new r is computed by . Otherwise, if , the new u is produced that is increased by 2 from the old u, then the new r is computed from . The iteration of both case will be run until . If found, the factorisation of N occurs as and .
Remark 1.
The sign ← represents an assignment of changes on a same value. For example, means the new value v is computed from the old value v with increment by 2.
2.3. Continued Fraction
The continued fraction is a non-integer expansion method that represents a decimal number into a list of integers. The list of the integer can establish a partial quotient that brings into a convergent list in term of a rational number. The continued fraction is suitable for the representation of the rational and irrational number like , Euler’s number, e, and . Chung et al. [14] mentioned that the continued fraction for a rational number may produce a finite yield of integer number while for an irrational number may produce an infinite yield an infinite list of an integer number.
Let r be a real number which has unique continued fraction expansion,
where and . The list of is a list integer form of r, thus, let with an amount of i represent the partial quotients as follows:
The list of partial quotients, is also known as a convergent list. The list of the convergence is significantly used for several purposes such as shortening the distance of the initial value in Fermat’s Factoring Algorithm and creating an approximate value of a rational number. Wu et al. [1] purposed Estimated Prime Factor in which used in application such as shortening the searching distance for (FFA2). It may give a “hint” for a new position for initial values of FFA2. The EPF will be discussed in the next section.
2.4. Estimated Prime Factor (EPF)
Wu et al. [1,9] proposed an approach to estimate and using EPF. The authors of [1,9] mentioned that the continued fraction of is used to give out the partial knowledge of in which helps to find and as and are unknown. From the list of convergent , is selected as the additional extension where and . The in-depth discussion of convergent in EPF is provided in Appendix A.
Remark 2.
Let be denominator of from convergent list pf . The value of is approximately less than N, , in which need to be less and closer to the value of N. As the value of N is known, it is easy to select by comparing with the value of N, and could be good indicator to select a good convergent of as there is i convergents on the list.
We illustrate EPF process in Figure 1.
Figure 1.
The process of Estimated Prime Factor (EPF).
3. Methodology
As early discussed in Section 1, Bressoud [13] claimed that the FFA2 has a better component for loop count without any multiplication or division and exhibit faster computational time. However, the FFA2 requires a huge number of cycles because it needs to search for the value of and , separately. Compare to FFA2, FFA1 needs to search for the value of only. This eliminates the process of searching for the value of , and thus reduces the number of loop count.
Table 1 shows the comparison of loop count between FFA1 and FFA2 based on three distinct moduli . The first modulus of 1,783,647,329 is taken from an example in [1]. Observed that the FFA1 dominates the smallest values of loop count (10,552) rather than the FFA2 (42,215) and the FFA2-EPF (11,455). For 195,656,557, again, the FFA1 dominates the smallest loop count compare to the other two methods. 1,952,194,393 is selected to illustrate the balanced prime situation. Similarly, the FFA1 recorded the smallest loop count, while the loop count for FFA2-EPF is not available as the initial value of u and v are larger than and . Overall, the FFA1 requires a lesser loop count, therefore it can factor modulus N relatively faster than the FFA2 and the FFA2-EPF.
Table 1.
The comparison on loop count between FFA1, FFA2, and FFA2-EPF based on 3 distinct modulus .
Recall that the initial value of the FFA1 started from and it increased by 1 until it reach the value . Therefore, there exists a distance, denoted by from the initial value where it starts from to : (as shown in Figure 2). The methodology is to introduce a new parameter , such that will be serve as a new initial value for the FFA1. The reason is to establish a new distance, , as shown in Figure 2, where . Therefore, a good is needed toward initial value of FFA1 to obtain the .
Figure 2.
The position of and .
In this work, the EPF method is used to extend the initial value of FFA1. We show that the EPF approach is suitable to be used in FFA1 with following conditions. Suppose and . Note that from Section 2.4, we have and . Recall that modulus , therefore
From Equation (3), the value is needed to improve FFA1, which obtained from the convergences of continued fraction of . Recall from Section 2.4, from the continued fraction of will established a list of . As a candidate , the is selected with and be the additional extension to improve the initial value of FFA1.
Now, the bound of will be consider. Recall in Section 2.4 where and , , we have . As , thus
We proceed with a lemma that shows is always smaller than .
Lemma 1.
Let and . If be a fraction from the convergent list of continued fraction with , then .
Proof.
Suppose there exist from convergent list of continued fraction . If , then substituting the Equation (2) into , thus it can be rewritten as follows.
□
Observation 1.
Consider Lemma 1. As is always smaller than , therefore via EPF can be use as the additional extension λ. Furthermore, we can set to serve as the (improved) initial value of x in the FFA1 algorithm.
In this study, we discover two types of possible selected convergent on the list. The first is Type 1: from the convergent list of where . For Type 1, Wu et al. [1] mentioned that can be an indicator of convergent with index t to select the good candidate for initial value.
Next, is the Type 2: where it is the last convergent on the list, which will be elaborated further. Thus, will be selected for additional extension for potential initial value.
The behaviour of Type 2 convergent selection is analysed via experiment on 50 distinct balanced prime moduli N. Figure 3 shows there are three possible positions on the potential initial value with additional extension that close to as follows.
Figure 3.
Three possible situations of Type 2 convergent selection.
Observation 2.
Figure 3 shows that Situation 1 happens when the value of is larger than the two initial values, Situation 2 shows that position is in the middle of potential initial values, and Situation 3 is where the value of is smaller than the potential initial values.
The result via experimental analysis of 50 distinct moduli N indicates that 33 moduli are considered as Type 2 convergent selection and 42.42% of them have potential initial value with additional extension and larger than (i.e., Situation 3), while the rest might fall under Situation 1 or Situation 2. This experimental analysis suggests that the position of those potential initials values close to is undecidable. This study aims to provide solutions that covered unbalanced and balanced primes for all three situations. The in-depth analysis of Type 2 will be discussed in Section 4.3.
4. Results and Discussion
By the observation in Section 3, an improvement for FFA1 to increase the effectiveness of the algorithm to factor a modulus N is sought after. The aim is to focus on three important parts: (i) EPF’s technique is used, (ii) establishing potential initial values for FFA1, and (iii) the alteration on the original FFA1 algorithm to suit the said potential initial value. Thus, we introduce mFFA1-EPF to improve the effectiveness of FFA1.
4.1. mFFA1-EPF: Unbalanced Prime
This section is dedicated for the modulus N with unbalanced primes factor. From Observation 1, we setting as the improved initial value in FFA1 algorithm is which less than . Let us start with the following question.
Question 1.
Is there any other potential initial values aside from that can be selected to shorten the distance towards ?
Answer.
Interestingly, if we can find other candidates for initial values in which potentially reduces the distance , then it can be useful to reduce the loop count to search for the value of . Suppose the value of is considered as the other candidate of potential values (i.e., the value of ). Then, such value is supposed close to . However, in general, it position is undecided whether is larger (as shown by Figure 4) or is smaller than (i.e., similar to Lemma 1).
Figure 4.
The position of .
Next, suppose there exist such that is from the convergent list of with . By empirical evident, the value can be considered as another candidate of additional extension for FFA1. Based on the empirical evident, it shows that the position of and are unpredictable as illustrated in Figure 5a,b.
Figure 5.
The possible position between , , , and .
There are three candidates for the potential values for : and . In answering Question 1, the algorithm will start to compute the first value, , while the second value is . Once and are established, then two values— and —are computed.
After establishing the values of a’s and y’s, three procedures run simultaneously:
- Procedure 1: The iteration with potential initial value and . The value is increased by 1 until is integer.
- Procedure 2: The iteration with potential initial value and . The value is increased by 1 until is integer.
- Procedure 3: The iteration with potential initial value and . The value is decreased by 1 until is integer.
Remark 3.
Note that the same value is applied in both Procedure 2 and Procedure 3. As the value might be larger than , the main role of Procedure 3 is to prevent the mFFA1-EPF algorithm to keep running forever. All of the procedure is done by parallel computing, which means that the algorithm will completely be stopped whenever one of the procedures outputs or as an integer. Eventually, p and q will be obtained.
Unbalanced prime is demonstrated in Algorithm 1 as follows and flowchart on Figure A1 in Appendix B.1.
| Algorithm 1: mFFA1-EPF: Unbalanced Prime |
![]() |
Remark 4.
For the Type 2 case, Step 1 on Algorithm 1 is changed by selecting and . Beside that, Step 3 will be modified with and .
Examples 1–4 are presented as illustrations of mFFA1-EPF for unbalanced primes. Example 1 demonstrates Type 1 of convergent-type selection, while Example 2 demonstrates Type 2 of convergent-type selection. Example 3 shows the importance of for this algorithm, and Example 4 shows the application of a previous example from Wu et al. [1].
Example 1.
Let . By the continued fraction method, the following list of fraction is created
We select as a candidate of and as a candidate of since . Now, the potential initial values are computed as follows:
- 26,676
- 26,746
With and , Algorithm 1 is performed. The algorithm is stopped when Procedure 2 satisfy the searching on Algorithm 1 where become an integer . Finally, and are computed.
Example 2.
Let . By continued fraction method, the following convergent list of is created
is selected as (the last convergent on the list) and as as . The potential initial values are computed as follows:
With and , Algorithm 1 is performed. The algorithm is stopped when Procedure 2 satisfies the searching on Algorithm 1 where become an integer . Last, and are computed.
Example 3.
Suppose . By continued fraction method, the following convergent list of is created
is selected as and as as . Now, the potential initial values are computed as follows:
With and , Algorithm 1 is performed. The algorithm is stopped when Procedure 3 satisfies the searching on Algorithm 1 where become integer . Last, and are computed.
Example 4.
Suppose which adapted from the numerical example of Wu et al. [1]. By continued fraction method, the following convergent list of is created
is selected as a candidate of and as a candidate of since . Two potential initial values are computed as follows:
Algorithm 1 is performed and stop when Procedure 1 satisfies that is an integer . Last, and are computed.
4.2. Discussion of Algorithm 1 (mFFA1-EPF: Unbalanced Primes)
This section presents a comparative analysis between the mFFA1-EPF and the previous technique, based on loop count and computational time. Note that all experimental results were using a computer running on 2.1 GHz on Intel® Core i3 with 4 GB of RAM.
According to Table 2, the loop count on Procedure 2 of Examples 1 and 2 is the shortest one. It shows that the mFFA1-EPF has the smallest loop count compared to the other methods. For Example 3, Procedure 3 has the shortest path (630), at the same time it indicates is larger than . Thus far, the results give a good visualization representing the factorization of modulus N by our method experimentally. Example 4 is the same example as given in Wu et al. [1]. Procedure 1 obtained the smallest loop count (346) compared to other methods. This N/A (Not Applicable) means that all the procedure in Algorithm 1 is stopped when one of the y’s from any procedures got the integer first.
Table 2.
The comparison on loop count between FFA1, FFA2, and FFA2-EPF with our propose method toward Examples 1–4.
The mFFA1-EPF is performed by parallel computing, which means Procedures 1–3 were run simultaneously. We recorded the computational time for the three different procedures. In Table 3, mFFA1-EPF is faster than FFA1 by 4 numerical examples. This seems to be a slight improvement for FFA1 as there is an involvement of additional extension. mFFA1-EPF is good in term of loop count, running without failure and computational time (compared to FFA1).
Table 3.
The comparison on computational time in second (s) between FFA1, FFA2, and FFA2-EPF with mFFA1-EPF toward Examples 1–4.
To make mFFA1-EPF more convincing, there are numerical examples from Somsuk [6] provided in Table 4.
This comparison highlights the improvement made by mFFA1-EPF compared to the method FFA-Euler, provided by Somsuk [6]. By two examples from in [6], the exhaustive search is improved with shortest loop counts, and the potential initial values are shorter than the FFA-Euler loop count. This shows that our method can be compatible with all unbalanced prime.
4.3. mFFA1-EPF: Balanced Prime
Previously, in the case of a modulus with unbalanced primes, three candidates are determined as the . Only two potential initial values that possibly shorten the were selected. In this section, we will explore the case of a modulus with balanced primes. The aim is to dictate the proper candidates from the convergent list (i.e., mFFA1-EPF) for the potential initial values via a similar approach.
Recall that with index t, where , deemed as the indicator for selecting a good convergent to additional extension of initial values for FFA2-EPF [1]. When the EPF technique applied for the balanced prime case on FFA1, by empirical evidence, it shows that such indicator leads to the initial value () relatively far away from the target value (exceeded by ). Therefore, we conjecture that the EPF method seems not to be an effective method to factor the modulus N with a balanced prime. Furthermore, the result in Somsuk [5] agreed that EPF is only suitable for unbalanced prime. It failed to address the convergent with index t as a suitable index to improve the initial value.
Therefore, in this section, we provide the strategies to address such drawback of factoring the modulus N with a balanced prime by imposing modification in the mFFA1-EPF algorithm. The strategies involve convergent selection and modification of potential initial values. Therefore, to enhance the effectiveness via mFFA1-EPF, the additional extension until is observe empirically to determine the smallest value of . The result of the observation is presented on Figure 6, and the discussion follows.
Figure 6.
The comparison value of 50 data (distinct modulus N) between , , , , and .
Suppose with index t where is chosen via EPF. Note that for the modulus N with balanced primes case, the value . Therefore, the additional extension from to is analysed. Interestingly, the additional extension for can be a potential initial values as it moves closer to the value of . Figure 6a–f shows comparison of potential initial values between the additional extension of for and , respectively. The potential initial values decrease, because the value of additional extension is become smaller from to (i.e., ).
Question 2.
What are the suitable initial values that need to be implemented on mFFA1-EPF with balanced primes?
Answer.
Based on Figure 6, the line graph between the initial value (represented by the blue dots) starts closer to the target value (represented by the red dots) as the value of initial values changes. A hindrance to the development process for this approach is that we can not determine the smallest value of via additional extension to . In other words, the “closeness” of the potential initial values with additional extension unable to be decided simply from the results of Figure 6. This is because the additional extension a random value from the generation of convergent list of . It requests further analysis. A statistical analysis of 50 distinct moduli N with balanced primes is conducted to determine the closeness of potential initial value through index t to , as follows.
In this work, a measurement called Mahalanobis Distance (MD) is implemented. MD is the distance between two points in multivariate space. According to Çakmakçı et al. [15], MD measures the distance between a multidimensional point of probability distribution and distribution of distance. The smaller the value of MD, the closer the mean of candidate of potential initial values to the mean of the target value.
In the one-dimensional case on the mFFA1-EPF for balanced prime, MD is used to calculate the normalized distance between the mean of each to and the mean of the target value . The measurement formula is
where is a mean of each data potential initial value of to while is mean of actual value . The value is calculated from combination data from potential initial value and the actual value . The following formula is represented for MD between and ,
We calculate MD for to by same data of 50 moduli N and represent the MD value on Table 5.
Table 5.
The comparison on the closeness of value between the candidate of potential initial value with by MD.
Table 5 shows the comparison of the MD index of “closer distance” between several potential initial values from to and . Table 5 reported that the MD index value of and are the smallest MD values among other potential initial values, that is, 0.0114 and 0.0116, respectively. It means that and are the most suitable candidates for potential initial values, because they have the smallest on average with respect to MD measurement.
Observation 3.
The candidates and have the smallest value of MD. Therefore, it is highly suggested to select convergents with index and to improve the initial values.
Based on Observation 3, two potential initial values are set as follows:
Remark that the FFA1 algorithm requires an initial value less than the target value and will keep increasing by one (i.e., +1) until it reaches . Therefore, in mFFA1-EPF, we use the variation technique, which means the value of and need to be increased and decreased by 1 simultaneously. Next, the following values are established:
Four procedures are introduced using the above values, with the variation technique as follows:
- Procedure 1: The iteration with potential initial values and . The value of is increased by 1 until it is the same as the becomes an integer.
- Procedure 2: The iteration with potential initial values and . The value of is increased by 1 until it is the same as becomes an integer.
- Procedure 3: The iteration with potential initial values and . The value of is decreased by 1 until it is the same as the becomes an integer.
- Procedure 4: The iteration with potential initial values and . The value of is decreased by 1 until it is the same as the becomes an integer.
Note that these four procedures were run simultaneously by parallel computing which will stop when one of the y’s become the first integer. Algorithm 2 shows how the workflow runs.
| Algorithm 2: mFFA1-EPF: Balanced Prime |
![]() |
4.4. Discussion on Algorithm 2 (mFFA1-EPF: Balanced Primes)
Algorithm 2 is also illustrated as a flowchart in Figure A2 in Appendix B.2. The experimental result is represented using the mFFA1-EPF via balanced prime on Example 5 while applying mFFA1-EPF is represented on Somsuk’s numerical example [6] in Example 6.
Example 5.
(Procedure 1 satisfies on Example 5). Let . By continued fraction method, the following convergent list is created
is selected as a candidate of and as a candidate of since . Now, there are two candidates of potential initial value and 2 y’s are computed as follows:
Algorithm 2 is performed because and not integers. The values and in Procedure 1 and 2 are increased by 1 while initial values in Procedure 3 and 4 are decreased by 1. The algorithm stop where from Procedure 1 is integer . Finally, compute and .
Example 6.
[6] (Procedure 1 satisfies on Example 6) Say . By continued fraction method, a list of fraction is created
is selected as a candidate of and as a candidate of since . Now, there are two candidates of potential initial value and 2 y’s are computed as follows:
Algorithm 2 is performed because and not integer. The values and in Procedure 1 and 2 are increased by 1 while initial values in Procedure 3 and 4 are decreased by 1. The algorithm stop where from Procedure 1 is integer . We compute and .
Table 6 shows the comparison on count loop and computational time in seconds (s), between several FFAs with our proposed method toward Example 5. The loop count on Procedure 1 (15412) is the least number of loop count compared to previous methods. Besides, FFA2-EPF can not undergo the process and the loop count is not available since the initial value exceeded the value of and . When it goes on computational time, the algorithm is not shown the fastest one but it still improves from FFA1.
Table 6.
The comparison on loop count and computational time in second (s) between several FFAs with our propose method toward Example 5.
For Table 7, mFFA1-EPF is applied toward [6] to compare the loop count and computational time. It shows the shortest loop count even the initial value is exactly the value of (). Using Algorithm 2, the loop count reduced significantly, which result in the exhaustive search to run without fail.
Table 7.
The comparison on loop count and computational time in second (s) between several FFAs with our propose method toward Example 6 [6].
Remark 5.
Consider Type 2 of the continued fraction convergent selection of the modulus N with balanced primes. For Type 2, we use Algorithm 2 with a changes in Step 2 where and and .
Now, we replicate a numerical example from the Algorithm 2 with respect to Remark 5 on Example 7.
Example 7.
(Procedure 4 satisfies on Example 7). Suppose . By continued fraction method, a convergent list of is created
As is the last convergent on the list, is selected as a candidate of and as a candidate of as . We compute two candidates of initial value of x, and as follows:
Since and are not integer, the values and in Procedures 1 and 2 are increased by 1 while initial values in Procedures 3 and 4 are decreased by 1. The algorithm stop where in Procedure 4 is integer . We compute and .
Table 8 shows the comparison on loop count and computational time in second between several FFAs with our propose method toward Example 7. Procedure 4 shows the smallest loop count with 1092 compared to FFA1 (1590) and FFA2 (10,553). The loop count of FFA2-EPF is unavailable as the initial values are exceeded the value of and . On computational time, our algorithm is slightly better than FFA1. Procedure 4 plays it crucial part to achieve the value , and, at the same time, Procedure 4 obtains the indicators of whether the value is larger or smaller than . Therefore, Algorithm 2 with Remark 5 helps to search for the value of without failure.
Table 8.
The comparison on loop count and computational time in second (s), between several FFAs with our propose method toward Example 7.
Recall that there is . For mFFA1-EPF, the varies according to type of modulus N; and for a modulus with unbalanced primes while and for a modulus with balanced primes. Multiple can lead to the shortest path toward . For comparison on mFFA1-EPF with FFA1, both methods use the same process of calculating the square roots to reach the target value . However, mFFA1-EPF uses the additional extension on its potential initial values where is the loop count of FFA1. Based on the empirical results in this work, the loop count and computational time of mFFA1-EPF are improved compared to FFA1. Consequently, it reduces the cost of running the exhaustive search.
The uniqueness of FFA2 is that it uses multiplication operation as the main process, it has less cost in computational time compared to the mFFA1-EPF which uses square root operation. Alas, FFA2 requires a greater number of iterations to achieve and . In this regard, the mFFA1-EPF uses less cost in terms of computational memory and less space to run the iteration compared to FFA2.
The objective of establishing additional extension on FFA2-EPF is the same as mFFA1-EPF, to shorten the path toward and . mFFA1-EPF has a shorter loop count than FFA2-EPF because the main operation comes from FFA2, which uses a huge number of iteration to achieve its target values: and . Thus, mFFA1-EPF requires less cost in terms of space compared to FFA2-EPF.
5. Conclusions and Future Works
In this study, we discovered two types of convergent list selections. The first is Type 1: is selected from the convergent list of where . For Type 1, Wu et al. [1] mentioned that can be an indicator of convergent with index t to select a good candidate for initial value. Next, Type 2: where is the last convergent on the list (as illustrated by Figure 4) where will be selected for additional extension for potential initial value. This paper proposed two improved factoring algorithms called mFFA1-EPF for unbalanced primes and mFFA1-EPF for balanced primes. The general idea for designing the algorithms is due to a modification made to EPF and then implemented to (improved) FFA1. The resulting study shows a significant improvement that reduces the loop count of FFA1 via (improved) EPF compared to previous methods (FFA1, FFA2, FFA2-EPF, and FFA-Euler).
An interesting limitation to our work is that the computational time of mFFA1-EPF is still far beyond efficient to factor a modulus with 1024-bit size of balanced primes, with the current technology. We foresee that the mFFA1-EPF might be useful once a large quantum computer with stable qubits is available. The mFFA1-EPF is a type of searching algorithm, thus it might take advantage of making fine adjustments or manipulating the mathematical nature within Grover’s searching quantum algorithm [16]. The mFFA1-EPF can be used in machine architecture with low power such as the Internet of Things-based devices, which requires to factor small composites integer [1,9]. Furthermore, we expect mFFA1-EPF to be an assistive tool to increase the effort on the machine learning and artificial intelligence approaches, such as in [17], have been introduced in the literature to deal with similar problems as ours.
Author Contributions
Conceptualization, M.A.A.; Formal Analysis, R.R.M.T.; Funding Acquisition, M.A.A.; Investigation, R.R.M.T. and Z.M.; Methodology, R.R.M.T.; Project Administration, M.A.A. and M.R.K.A.; Software, Z.M.; Supervision, M.A.A. and M.R.K.A.; Validation, M.A.A., M.R.K.A. and Z.M.; Writing—Original Draft, R.R.M.T.; Writing—Review & Editing, R.R.M.T. and M.A.A. All authors have read and agreed to the published version of the manuscript.
Funding
The present research was supported by Universiti Putra Malaysia under Putra Grant—IPM with project number GP-IPM/2017/9519200.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Not applicable.
Acknowledgments
Not applicable.
Conflicts of Interest
The authors declare no conflict of interest.
Appendix A. The Proving on Estimated Prime Factor (EPF)
We discuss the original study by Wu et al. [1,9]. There is a distance between p and q with that written as
We do not have any informations about the value of and . However, from Equation (A7), can be useful to get and as N is publically known. Now, a convergent list is produced by continued fraction.
Suppose there is a convergent list , assign as with and i be a number of the convergent produced. From the continued fraction, we know that as . As the size and increase as i increase, there exist t such that
We use and to correspond the estimation of and that is
The convergent with index t be the selection fraction for improving the FFA as it give an advantage on shorten the exhasutive search on and .
Appendix B. Flowchart mFFA1-EPF
Appendix B.1. mFFA1-EPF on Unbalanced Prime
Figure A1.
The flowchart of mFFA1-EPF on unbalanced prime.
Appendix B.2. mFFA1-EPF on Balanced Prime
Figure A2.
The flowchart of mFFA1-EPF on balanced prime.
References
- Wu, M.E.; Tso, R.; Sun, H.M. On the improvement of Fermat Factorization using a Continued Fraction technique. Future Gener. Comput. Syst. 2014, 30, 162–168. [Google Scholar] [CrossRef] [Scilit]
- Ghafar, A.H.A.; Ariffin, M.R.K.; Asbullah, M.A. A New LSB Attack on Special-Structured RSA Primes. Symmetry 2020, 12, 838. [Google Scholar] [CrossRef] [Scilit]
- Ambedkar, B.R.; Gupta, A.; Gautam, P.; Bedi, S.S. An efficient method to factorize the RSA public key encryption. In Proceedings of the 2011 International Conference on Communication Systems and Network Technologies, Katra, India, 3–5 June 2011; pp. 108–111. [Google Scholar]
- Somsuk, K.; Tientanopajai, K. An Improvement of Fermat’s Factorization by Considering the Last m Digits of Modulus to Decrease Computation Time. IJ Netw. Secur. 2017, 19, 99–111. [Google Scholar]
- Somsuk, K. The improvement of initial value closer to the target for Fermat’s factorization algorithm. J. Discret. Math. Sci. Cryptogr. 2018, 21, 1573–1580. [Google Scholar] [CrossRef] [Scilit]
- Somsuk, K. The new integer factorization algorithm based on fermat’s factorization algorithm and euler’s theorem. Int. J. Electr. Comput. Eng. 2020, 10, 1469–1476. [Google Scholar] [CrossRef] [Scilit]
- Somsuk, K.; Kasemvilas, S. MFFV2 and MNQSV2: Improved factorization Algorithms. In Proceedings of the 2013 International Conference on Information Science and Applications (ICISA), Pattaya, Thailand, 24–26 June 2013; pp. 1–3. [Google Scholar]
- Somsuk, K.; Chiawchanwattana, T.; Sanemueang, C. Estimating the new Initial Value of Trial Division Algorithm for Balanced Modulus to Decrease Computation Loops. In Proceedings of the 2019 16th International Joint Conference on Computer Science and Software Engineering (JCSSE), Chonburi, Thailand, 10–12 July 2019; pp. 143–147. [Google Scholar]
- Wu, M.E.; Chen, C.M.; Lin, Y.H.; Sun, H.M. On the improvement of Wiener attack on RSA with small Private Exponent. Sci. World J. 2014, 2014, 650537. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Asbullah, M.A.; Ariffin, M.R.K. Another Proof Of Wiener’s Short Secret Exponent. Malays. J. Sci. 2019, 38 (Suppl. 1), 67–73. [Google Scholar] [CrossRef] [Scilit]
- Ruzai, W.N.A.; Ariffin, M.R.K.; Asbullah, M.A.; Mahad, Z.; Nawawi, A. On the Improvement Attack Upon Some Variants of RSA Cryptosystem via the Continued Fractions Method. IEEE Access 2020, 8, 80997–81006. [Google Scholar] [CrossRef] [Scilit]
- De Weger, B. Cryptanalysis of RSA with small prime difference. Appl. Algebra Eng. Commun. Comput. 2002, 13, 17–28. [Google Scholar] [CrossRef] [Scilit]
- Bressoud, D.M. Factorization and Primality Testing; Springer: New York, NY, USA, 1989; pp. 58–61. [Google Scholar]
- Chung, H.; Kim, M.; Al Badawi, A.; Aung, K.M.M.; Veeravalli, B. Homomorphic Comparison for Point Numbers with User-Controllable Precision and Its Applications. Symmetry 2020, 12, 788. [Google Scholar] [CrossRef] [Scilit]
- Çakmakçı, S.D.; Kemmerich, T.; Ahmed, T.; Baykal, N. Online DDoS attack detection using Mahalanobis distance and Kernel-based learning algorithm. J. Netw. Comput. Appl. 2020, 168, 102756. [Google Scholar] [CrossRef] [Scilit]
- Chuang, I.L.; Gershenfeld, N.; Kubinec, M. Experimental implementation of fast quantum searching. Phys. Rev. Lett. 1998, 80, 3408. [Google Scholar] [CrossRef] [Scilit]
- Huang, X.L.; Ma, X.; Hu, F. Machine Learning and Intelligent Communications. Mob. Netw. Appl. 2018, 23, 68–70. [Google Scholar] [CrossRef] [Scilit]
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).









