Pseudo-prime number simulation and its application for security purpose

Many public cryptography schemes rely on the use of prime numbers like for encryption and decryption. A prime number is one number that is widely used and large and consists of hundreds of digits, so it takes time to test whether the numbers are prime or not. Miller-Rabin is one algorithm that could be used to test prime number. Simulation to show how to test non-prime number elimination process can be used to determine the workings of the Miller-Rabin algorithm and also could be used as a media learning for students and lecturers to know how prime number test and generation.


Introduction
In mathematics, prime numbers are natural numbers that only have two factors, namely the divisor is 1 and the number itself [1]. The uniqueness of prime numbers is widely used in cryptographic algorithms especially on key generation [2][3][4], the strength of a cryptography algorithm depends on the key used [5][6][7] and prime number is one of the factors that determine the strength of security [8][9][10]. Few algorithms using a prime number for the key is RSA, RC4 and Blowfish algorithm using the prime number in p and q key for encryption and decryption process [11][12][13][14], this prime numbers become essential not only in mathematics but also in computer science.
The problem that arises is that the prime number is infinite. Not only that, many numbers are glimpsed like primes, but in reality they are not [1,15]. This problem causes the search for prime numbers takes longer time for using as key in cryptography algorithms. An alternative that can be used to overcome this problem is to use the prime test algorithm [15].
One of the prime number tests is Miller-Rabin algorithm. The algorithm works by utilizing the Fermat method where each number tested will go through the process of elimination based on the probability of the prime rate of that number [16]. The output of the Miller-Rabin algorithm is entirely accurate, and the workflow is easy to follow, this reason makes Miller-Rabin algorithm suitable to be implemented in the form of a prime generator software, especially simulation software and also it can be used for security and education purpose.

Prime Numbers
The prime number is a positive integer a, where a ≥ 2 can only be divided by 1 and the number itself. The nature of division of integers gives birth to the concepts of prime numbers and modulo arithmetic [1,15,[17][18][19]. Most public-key algorithms use prime numbers as one of their parameter values [20,21]. There are several important properties that only prime numbers have: a. All prime numbers are odd numbers, except 2. b. The number of primes that will not exceed x is π (x)<x. c. Hadamard Poussin's theorem states that approach expresses the number of primes for x → ∞: π (x) ≈ x / (ln (x)) d. Any positive integer more than one has a prime divisor. e. If n is a composite number, then it has a prime factor not greater than √n. f. Any integer greater than 1 can be denoted singly as a result of multiplication of prime numbers.

Miller-Rabin
The Miller-Rabin algorithm is based on Fermat's theorem states that −1 ≡ 1 if n is a prime and a root or solution x of x 2 (mod n) having at least four roots if n is complex [22,23].
Miller-Rabin algorithm workflow can be described as follows: a. Take a random located at interval 1 <a ≤ n-1 and then count using equation = if T = ± 1, then it is concluded n may be prime. b. If T 2 = 1, then it is concluded n compound, and the algorithm stops. If T 2 = -1, then n may be primed. If T 2 ≠ 1, proceed to step 3. c. Calculate 2 2 = 2 2 . If 2 2 = 1 then it is concluded n compound and algorithm will be stopped. If T ^ (2 ^ 2) = -1 then concluded n may be prime. If 2 2 ≠ ±1 the process (step 3) is repeated until 2 −1 if until the last iteration is obtained 2 −1 > 1 ( ≠ ±1), concluded n compound.

Results and Discussion
The simulation of the prime generator using Miller-Rabin algorithm is performed by generating and testing randomly generated numbers, and a simple experiment was to count 13 is it prime or not. a. Calculating the Value of s and d Before calculating the value of s and d, first calculated the value of N-1, where N is the number to be checked the primes value, from the case example, we get N -1 as follows: N-1 = 13-1 = 12 Next is calculated the value of s and d by using the formula d * 2 s = N-1, where d is a positive odd number, d> 0 and s ≥ 1. b. Determining the Level of Accuracy The process of testing prime numbers will do the generation of random numbers that serve as test numbers. The amount of generation of this test number will determine the accuracy of the results of primes c. Generating Test Numbers The Miller-Rabin algorithm uses a random number a, which will be used to find the value of x through the following equation: x = a d mod N. If the value of x = 1 or the value of x = N-1, then this step will result in a True value for the test number a. If the value of x does not meet the above requirements, search for the next x value by using the following equation: = 2 * , where i is Since the value of x = 1, then the third test is True. Since all tests from k1 to k4 are true, it can be concluded that number 19 is a prime number. The Miller-Rabin algorithm simulation created using Java Netbeans displays the result of prime numbers of n with varying amount of time, the designed app displays the numbers that are prime numbers and the required processing time as follows:     The experiment shows the number of primes as much as n number, based on the test that has been done the more prime numbers generated and tested using Miller-Rabin algorithm then it takes a relatively long time, one example is to generate and test as many as 100000 prime numbers require time 13 second but for 1000000 primes takes 3 minutes, for some experiment can be seen in table 1 below: Based on table 1 it will like this figure 6 below where the process will take exponential in time. The prime numbers generated in the application are numerous, whereas the use of p and q keys in cryptography requires only 2 pieces and must use large number, assuming the key value of p and q above 500000 <10000000 then the required time will not be up to 3 minutes to get value of p and q.

Conclusion
Testing prime numbers using the Miller-Rabin algorithm can be done well and the results are also entirely accurate even up to 1 million prime numbers can be completed by 3 minutes, the Miller-Rabin algorithm is very appropriate as an additional algorithm in the cryptographic process so that the determination of the key p and q which are generally prime numbers in cryptography like RSA, RC5, Pohlig-Hellman can be generated quickly.