A Fast Factorization Method

Integer factorization is one of the mathematical aspects which are largely applied in our daily activities. One of the situations where factoring is applied is in cryptography which is the treasured portion of e-commerce systems. Due improved encryption currently banking institutions, business firms, government institutions, online merchants and many other groups and individuals are using e-commerce platform to send and receive confidential information such as transferring money. Cryptography enhances the integrity and authenticity of the data and communication between legit by assigning specific private keys to participants. The keys are generated by factorizing a large number, and they can only be decrypted by the assigned individuals only. The number under quest is large enough such that finding their factors which are the keys takes a lot of time and becomes costly than the information encrypted by those keys especially when using the old Trial Division method. Therefore it has been a concern of researchers to come up with a better method of finding the Keys.


Introduction
Key cryptography which is based on integer factorization is the most applied type of cryptography in the e-commerce systems for ensuring integrity, confidentiality, and authenticity of the information shared via those systems. There are many algorithms available which can be used to generate the keys, but in this discussion, we are going to consider the RSA algorithm in generating cryptography keys [1]. In RSA algorithm there two are two large prime numbers 'a' and 'b', which are factors of a larger number, n. Let the e-commerce system have person A and person B, according to key cryptography everyone is required to have unique keys assigned to them. Each participant is required to have a public and a private key. A public key will allow the participants to accessed by whoever wants to reach them out whereas a private key ensures that it is only the intended recipient who has legit access to the information shared. Let person A have <x,n> as his public key and <y,n> as his private key. We have n being a large selected number know to the public with two prime factors 'a' and 'b' (note that with the two prime factors xy = 1 (mod (a-1) (b-1))). This indicates that the security of the private key <y,n> relies on the difficulty of finding the two prime factors of an integer n. So in the case where person B wants to communicate to 1 Electronic copy available at: https://ssrn.com/abstract=3046053 person A, he would need access to <x,n> to send him an encrypted message. Person B will determine M' = mod n indicated as , thus encrypting message M which can only be decrypted by person A using the specified key. Upon reception of the message person A, will be required to determine M'' for him to access the contents of the sent message. In determining M'' person A, decrypts the secured message M, M'' = = M (mod n). Ideally the only person who is in a position to decrypt message M is person A because he is the only one who acknowledges y. Since the message to be decrypted it requires y which is only know to person A, and then the message is considered to be secure. Therefore, for the attacker to access the encrypted message he/she needs x and y, x is available as the public key of person A but factorization of n should be performed to find y [2]. The security of encrypted messages and the RSA keys depend on the complexity of factoring. For the purpose of intensifying the security of RSA, integer n to be selected should be too large and complex to factor such that the cost of decrypting unauthorized data becomes expensive to scare attackers away [3].

Unauthorized decryption of information
Despite the RSA key cryptography is one of the preferred secure key algorithms attackers have developed more sophisticated methods of getting into systems secure by RSA. Although the attackers being able to work with approaches such as Timing attacks, mathematical attacks, Chosen Ciphertext attacks, and Brute force attacks, there has been a need of coming up with a faster and a less costly approach. Timing attacks work by approximating the time the RSA key cryptography uses to generate the private encrypted key and uses that time to determine y. On the hand, mathematical attacks deploy different tactics based on the structures of the RSA cryptography to factor n with the objective of decrypting the encrypted messages.
Where Brute Force attack is based on trials, all possible keys are tried to see if they can match that of the encrypted message. The Brute Force attack and others which have been in use still use a lot of time to decrypt information [4]. Concerning the quest of having a faster and less costly approach the Fast Factorization Method was developed and has proven to serve the purpose.

Timing attacks
As mentioned above, the timing attacks are time approximation based approaches which can be used to attack RSA key cryptography messages. During encryption, the RSA algorithm computes M' = (mod n) which is the security key for the data to be transmitted. Timing attacks estimate the time taken to compute M' and uses that time to determine y and uses it to decrypt the message.

Mathematical attacks
The RSA key algorithm bases its security on the difficulty of finding the two prime factor of an integer n.
Therefore, if anyone comes up with a way of determining those factors ('a' and 'b') then he/she has access to whatever data which is encrypted with that algorithm. Mathematical attacks deploy different approaches based on the RSA key functionality with the aim of factoring n into ' a ' a n d 'b'. After determining the prime factor, it would be easy to find y and M'' hence decrypting the message [5].

Brute Force attacks
As indicated above, Brute Force attacks are based on trial mechanism; the attackers attempt to decrypt given information by the use of all possible combination of private and public keys. Based on the trial and error approach, picking the correct key is possible with small sized numbers, but it becomes difficult to guess a key if the number under quest is very large. Therefore large integers are recommended in the RSA algorithms to outwit Brute Force attackers. On the other hand, very large integers are not efficient as the algorithm will require a lot of time for internal computations thus inconveniencing the transmission and reception of information therefore not a right approach of scaring brute force attackers away. For that reason, integer n is kept reasonable but then attackers bewildered from the data [6].

Factorization Method
The integer n in the RSA key cryptography is a large size number such that the other approaches which have been in use before have not been able to factor it fast enough within the utility time. The two large prime factors x and y are the major concern of an attacker [7]. From the above, the information sent to person A is encrypted in y, x , and n are public therefore the task is to find y which is only possible in determining the factors of n. The other existing approaches can determine the factors 'a' and 'b' but then the time it takes is the only major drawback. We are looking at factorization methods which is less costly and which can realize the factors fast enough when the information is still valuable [8].

Trial Division
Trial division approach is the simplest to apply in determining the prime factor of an integer n, in this case, n is subjected to division by small prime integers. The small prime number applicable starts with 2, 3, 5, 7 so on up to any reasonable small prime integer. The division process is continuously conducted up to a point it cannot further be divisible. A remainder of zero at the end of the division indicates that n is divisible by the prime number used. The process aims at determining a prime number which is equal to or close to but not more than the square root of n.

Example;
In determining the factors of 91, we can use small prime numbers below it such as 2, 3, 5, 7. Remember we can't try with a prime beyond seven because we need a prime number which is close or equal but not more than its square root. When 91 which is our n, in this case, is divided by 7 we get a reminder of 0 implying we got one of our factors at that point. Since a x b should be equal to 91, then our factors are 7 and 13 [9].
Compared to other factorization methods available, Trial Division is the simplest and easiest to follow. It is efficient in determining prime factors of small numbers ranging from 0 to 9 digits numbers. Applying trial division on the number with more than 9 digits can take extremely long trying to guess possible prime factors thus it will be costly and time-consuming.

Pollard's P-1
The Pollard's P-1 algorithm uses Fermat's Little Theorem in determining prime factors of n.

Pollard's Rho Method
Looking at the weakness of Trial Division Method, John M Pollard decided to improve on it. The improved method enables the user to find the factor of numbers of up to doing the equivalent to factoring integer n using the trial division method.

Quadratic Sieve
Quadratic Sieve factoring algorithm is an improvement on the Dixon's random square method and the Fermat's method. The algorithm was developed objectively to work on integers with digits of between 50 and 100. Between the years of 1980's and 1990's Quadratic Sieve method was considered the most effective. The time taken to work only depended on the size of integer n.
The Quadratic Sieve states that which meant A non-trivial factor of n was determined by computing GCD ((x-y), n) and that of GCD ((x+y), n) [10].

The Fast Factorization Method
When dealing with the information coded with the RSA key algorithm you need a versatile and convenient factoring method. We are looking at the factorization method which is less costly and which can realize the factors fast enough when the information is still valuable
The code uses the GMP library, to use it; 1. Create a new folder on your desktop and give it a label which you can remember 2. In the created folder insert the following files; main.c, steps1.h, and steps2.c.