Cryptographic Algorithm Using Newton-Raphson Method and General Bischi-Naimzadah Duopoly System

Image encryption is an excellent method for the protection of image content. Most authors used the permutation-substitution model to encrypt/decrypt the image. Chaos-based image encryption methods are used in this model to shuffle the rows/columns and change the pixel values. In parallel, authors proposed permutation using non-chaotic methods and have displayed good results in comparison to chaos-based methods. In the current article, a new image encryption algorithm is designed using combination of Newton-Raphson’s method (non-chaotic) and general Bischi-Naimzadah duopoly system as a hyperchaotic two-dimensional map. The plain image is first shuffled by using Newton-Raphson’s method. Next, a secret matrix with the same size of the plain image is created using general Bischi-Naimzadah duopoly system. Finally, the XOR between the secret matrix and the shuffled image is calculated and then the cipher image is obtained. Several security experiments are executed to measure the efficiency of the proposed algorithm, such as key space analysis, correlation coefficients analysis, histogram analysis, entropy analysis, differential attacks analysis, key sensitivity analysis, robustness analysis, chosen plaintext attack analysis, computational analysis, and NIST statistical Tests. Compared to many recent algorithms, the proposed algorithm has good security efficiency.


Introduction
Digital images play a critical role in the world today. Digital images make up 70% of the transmitted data via the Internet [1]. They often contain sensitive and valuable information which requires protection against unauthorised access in various applications such as military images, medical images and Satellite images. Therefore, researchers have been designing methods to protect digital images from piracy while they are transferred from one place to another such as encryption algorithms via chaos [2][3][4][5][6], DNA coding [7], and wavelets [8]. Also S-boxes play an excellent role in confirming the resistance of block ciphers against cryptanalysis [9]. In Reference [10], the authors presented an efficient algorithm based on a class of Mordell elliptic curves to generate S-boxes. One of the most stable and powerful public key cryptosystems has been proven to be the Elliptic Curve Cryptography, which is popular for its high performance. But improving protection by increasing the duration of the key is inefficient [11,12].
Among the many ways of image cryptography, the image cryptography based on chaotic map will selected over the past two decades. This is because the chaotic mappings have necessary proprieties such as high sensitivity to the initial conditions and the parameters, nonlinearity, non-periodicity, and pseudorandomness [13][14][15][16][17]. Numerous researchers have presented image cryptography algorithms via chaotic maps. Some of these algorithms have limited key space, weak keys, vulnerability to chosen plaintext/ciphertext attacks [18][19][20]. Almost all the authors used the permutation-substitution (confusiondiffusion) model to encrypt/decrypt the image. There are different permutation methods, from performing a shuffling to rows/columns to performing more complicated iterative processes. For example, in Reference [3], the authors proposed rows/columns shuffling

General Bischi-Naimzadah Duopoly System (GBNDS)
The image encryption needs a sequences of random numbers to generate a good secret image. The current paper takes advantage of the effectiveness of the general Bischi-Naimzadah duopoly system to generate pseudorandom numbers. The general Bischi-Naimzada game is a market vying between two companies based on sales constraints with the aim of maximising profits. The general Bischi-Naimzadah duopoly system is mathematically defined as [38]: where q i : the output of company i = 1, 2, a > 0: constant price, b > 0: the market price slope, c i : the marginal cost, i = 1, 2, µ i > 0: associated with the sales constraint, i = 1, 2, ν i > 0: the adjustment speed of company i = 1, 2.
The chaotic behavior of system (1) is observed by the values of the parameters: a = 11.25, b = 0.5, c 1 = 0.20, c 2 = 0.30, µ 1 = 0.002, µ 2 = 0.60, ν 1 = 0.20, ν 2 = 0.70 and initial values q 10 = 0.10, q 20 = 0.20. Figure 1a displays the bifurcation diagram of system (1) regarding the parameter µ 1 . Lyapunov exponent of system (1) regarding the parameter µ 1 is shown in Figure 1b. Figure 2 displays phase diagram of system (1). It presents four unconnected chaotic areas. Whereas the phase diagram of system (1) at µ 1 = 0.97 is given in Figure 3 and it presents a chaotic attractor. The main advantages of the proposed coding scheme compared to other systems in the literature is that the chaotic coding sequence extracted from the GBNDS is extremely random. This is because this it contains many chaotic regions for different values of the parameters. The proposed system also shows a great positive feature, which is the emergence of a very wide range of chaos and complex dynamics with the parameter µ 1 in which the system (1) shows very complex chaotic behavior [38]. Moreover, incorporating the effects of sales constraints into the form has the advantage of increasing the number of parameters in the form and thus expanding the secret key space for the cryptography process. Also, a stable coexistence of multiple chaotic attractions is observed in this case [38].

The Proposed Algorithm
The proposed method applies confusion-diffusion model to encrypt the plain image. Sequences are generated by the points, calculated by Newton-Raphson's method, on a polynomial function. Based on these sequences, the rows/columns of the plain image are shuffled (confusion phase). By applying XOR between the shuffled image and the generated values of the chaotic system (1), the diffusion stage modifies the pixel values. In the current section, the key generation, rows/columns Shuffling, and an image encryption/decryption algorithms are presented.

The Key Generation
Suppose that O = (o ij ), i = 1, 2, ..., M, and j = 1, 2, ..., N, is the plain image. The secret key is generated by using the key mixing proportion factor K as follows [36]: and, the key values ζ s is changed via the following formula: where [x] denoted to the nearest integer and ζ s denoted to q s0 , s = 1, 2.
The key space of the proposed algorithm consists of the polynomial function with degree k and limits of [α, β] for the Newton-Raphson's method, two initial values and eight parameters for GBNDS. Then, for the confusion phase, select two values, α, β, and one polynomial function based on Newton-Raphson's method, and for diffusion phase, two initial values, q 10 , q 20 , and eight parameters a, b, c 1 , c 2 , µ 1 , µ 2 , ν 1 , ν 2 for the System (1).

Rows/Columns Shuffling (Confusion Phase)
In this section, we design a technique for generating a random permutation of the integers {1, 2, . . . , n}. Then, we shuffle the rows/columns of the plain image via the random permutation sequences.
Suppose a polynomial function of degree s, p(x) = ∑ s i=1 a i x i , where a s = 0 and s > 1, is defined on the interval [α, β]. Take x 0 = (α + β)/2 and Newton-Raphson's method generates the sequence {x i } ∞ i=0 by the following formula: Suppose, the Newton-Raphson's method generates the points {x 1 , x 2 , x 3 , . . . , x n }. To get more randomness, instead of p(x i ), the sequence is defined as the fraction part of p(x i ). This sequence depends on the polynomial p(x) and the interval [α, β].
The standard NIST SP800-22 test is used to assess the efficiency of the pseudorandom number generator(PRNG) of Newton-Raphson's method, and Table 1 gives the test results. In Table 1, the random number generator has passed all the tests. So, it has a good randomness.
Step 1: Step 3: S Suppose the size of the plain image is M × N. Algorithm 2 is designed to shuffle the plain image based on the random permutation sequences of Algorithm 1. It may be processed as in Algorithm 2.

Diffusion Phase
The system (1) is utilized to generate a chaotic sequence of size M × N. Then, reshape it to be of size 1 × MN, Q = {q 1 , q 2 , . . . , q MN }. The sequence Q is modified using the following formula:
Output: H, the shuffled image.
Step 1: Step 2: Use Algorithm 1, with polynomial p(x), and interval [α 1 , β 1 ], to generate a random permutation of size M for shuffling the rows, say S Rows .
Step 3: Use Algorithm 1, with polynomial p(x), and interval [α 2 , β 2 ], to generate a random permutation of size N for shuffling the columns, say S Columns .
Finally, XOR is applied between each pixel in H and corresponding chaotic value of X, D = XOR(H, X) (diffusion phase). The algorithm of diffusion phase may be processed as follows:
Step 1: Step 2: Covert H to binary, H b .

The Encryption/Decryption Algorithm
The encrypted image is produced from Algorithm 3 by reshape diffusion vector D to be of size M × N, say E. The whole image encryption algorithm may be processed as in the Algorithm 4.
The Algorithm 4 (Image Encryption based on General Bischi-Naimzadah Duopoly System) will be referred to as IEGBNDS algorithm. Indeed, IEGBNDS algorithm can be applied to encrypt the color images. We can decompose color images into three grayscale images of red, green and blue colors (R, G, B components). After that we can encrypt them into their corresponding cipher images by applying the proposed algorithm. Then by re-joining the three cipher images of the R, G, B components, the color cipher image can be obtained.
Step 1: Read the plain image, O.
Step 2: Generate the secret key by using the key mixing proportion factor.
Step 3: Call Algorithm 2 to get the shuffled image H.
Step 4: Call Algorithm 3 to get the diffusion vector D.
Step 5: Covert D to decimal, say D d .
Step 6: Change the dimension of D d to M × N, say E.
Step 7: E is the encrypted image.
The decryption algorithm is the inverse steps of IEGBNDS algorithm. Figure 4 displays the block diagram of IEGBNDS algorithm.

Experimental Results
The IEGBNDS algorithm has been applied to several 512 × 512 pixel gray-scale images and very promising results have been accomplished. All codes are accomplished on a Windows 10 Laptop with Intel(R) Core(TM) i7 2.40 GHz, CPU with 12 GB RAM using MATLAB R2016b.

Key Space Analysis
The key space must be large enough to hold out against brute-force attack. It must be above the value 2 100 [39]. The key space of the IEGBNDS algorithm consists of the polynomial function with degree k and limits of [α, β] for the Newton-Raphson's method, two initial values and eight parameters for GBNDS. If the accuracy 10 −14 has been used then it will be equal to 10 14(k+1) + 10 168 (>> 2 100 ). Table 2 gives the key space of the IEGBNDS algorithm compared to some recent algorithms in literature.

Histogram Analysis
In a good encryption algorithms, the distribution of the pixel intensity values within a cipher image should be as similar to the uniform distribution as possible. Figures 5 and 6 show that the histograms of the cipher image is very similar to the uniform distribution. As the χ 2 statistical test is used to measure the nearness of produced histograms to the uniform histogram. The statistical χ 2 -value is evaluated by [6]:  Table 3 shows that all tested images are smaller than 293.25. Therefore, the cipher images histograms are close to the uniform distributions. In other words, an attacker cannot retrieve any valuable information from them.  The variance and standard deviation are dispersion metrics applied in graphic histograms to help the effects of visual inspection. They calculate how often the elements of a dataset differ across the average with respect to each other. The same average value (mean) can be in two datasets, but the differences may be dramatically different. If the histogram has the lower variance then it has the more uniform of the graphic histogram, which is calculated by the following formula: θ i is the frequency for each pixel's value from 0 − 255 of the histogram, i = 1, 2, . . . , 256, θ is the histogram mean. The standard deviation helps us to know the arithmetic average of the dataset's variations relative to the mean. It is calculated as follows: where V is the histogram variance. Table 4 presents the histogram statistics for the plain and cipher images of the tested images for the IEGBNDS algorithm and the encryption algorithm in Reference [41].

Entropy Analysis
Information entropy [7] is utilized to detect the randomness of the cipher image. It is computed as follows: where P i is the probability associated with gray level i. The largest value of the entropy reflects the randomness of the encrypted image. The maximum value of the entropy in our case is 8. Table 5 gives the information entropy for the plain and cipher images of the tested images. All values of entropy based on our algorithm are close to 8. In addition, the IEGB-NDS algorithm gives average better than most averages of the listed recent algorithms. Based on the results of entropy, the IEGBNDS algorithm has reasonable protection.

Image Information Entropy
Plain Image Encrypted Image

Correlation Coefficients Analysis
In the plain image, adjacent pixels have strong relationships. So, reducing these relationships is required to hold out against statistical attacks. The correlation coefficient between two adjacent pixels, θ and φ, is defined as [6]: where and where θ and φ are selected randomly. 3000 pairs of adjacent pixels are chosen randomly from the plain and cipher images. Figure 7 displays the pixel intensity value's distribution of 3000 pairs for the Barbara image and its encrypted image in the three directions, diagonal, horizontal, and vertical. The correlation coefficients of the three directions for the IEGB-NDS algorithm compared to some recent encryption algorithms based on the average of the correlation coefficients are given in Table 6. Table 6 shows that the IEGBNDS algorithm outperforms all of them at least in one direction. Also all values of r θφ for the cipher images are close to zero. So, it can protect the image information.

Differential Attack Analysis
The protection against differential attacks is required for any image encryption algorithm. There are two main measurements, (1) NPCR (Number of Pixel Change Rate), and (2) U ACI (Unified Average Changing Intensity). These measurements evaluated the amount of differences between two images, and can be defined as [5]: where A single pixel of the plain image is selected randomly and it modified to 255 − v, where v is the original intensity value of pixel. The same key is utilized to encrypt the modified image and the plain image. Then, NPCR, and U ACI are calculated using the two cipher images. Table 7 shows NPCR and U ACI for the tested images and compared them to some recent algorithms in literature. The IEGBNDS algorithm offers a good level of security. Based on the averages of NPCR and U ACI, the IEGBNDS algorithm outperforms all of them at least in one of the two measures. So, the IEGBNDS algorithm can be useful against differential attacks.

Key Sensitivity Analysis
The sensitivity to the secret key is one of the important features of an excellent encryption algorithm. During the restoring plain image (decryption process), small changes in one of the initial values or parameter are made and we will observe the restoring image via the modified secret key. Table 8 shows the restoring images using the true secret key and the modified secret keys. The plain image cannot be restored by any of modified secret keys. Therefore, the IEGBNDS algorithm is highly sensitive to any changes of the secret key. wrong key b × 10 −14 wrong key µ 1 × 10 −14 wrong key ν 1 × 10 −14

Robustness Analysis
In real life, noise or data loss is occurred and the IEGBNDS algorithm is tested against these problems. Salt&Pepper noise with different densities are added to the cipher image of lena with size 512 × 512. Table 9 shows the decrypted images of the noisy encrypted images. Moreover, the decryption image of the encryption image with some data loss is shown in Table 9. Based on the result of Table 9, The IEGBNDS algorithm can be robust against the noise and data loss attacks.

Chosen Plaintext Attack Analysis
The IEGBNDS algorithm is sensitive to the key generation, K s , in Equation (2) and different sequences will be generated by small changes in the plain image. So, the IEGBNDS algorithm can hold out against the plaintext attacks. Now, we will examine the IEGBNDS algorithm against the chosen plaintext attack. Suppose the attacker has the encrypted image and the running of the IEGBNDS algorithm for a short time. The algorithm of Reference [42] will be used to examine our algorithm against chosen plaintext attack. In this algorithm, the following notations will be used: The XOR operations between the pixels of E and E D are performed to obtain the plain image P. Based on the result of Figure 8, the decrypted image is totally unlike the plain image. Therefore, the IEGBNDS algorithm can resist chosen plaintext attack.

Computational Analysis
The average times of encryption and decryption algorithm for one hundred time are 34.11 ms and 30.57 ms (Tested image of size 512 × 512), respectively. On the other hand, for the tested image of size M × N, the encryption algorithm needs 5 MN + M + N + 2000 operations. The complexity time for the decryption algorithm is equal to the complexity time of the encryption algorithm. Table 10 shows that the running time of the IEGBNDS algorithm is effective compared to some recent image encryption algorithms such as in Reference [40] by Shakiba and Reference [23] by Cao et al.

NIST Statistical Tests
NIST were established to test the randomness of generating cipher images created by encryption algorithms [43]. For the IEGBNDS algorithm, it is used to check the randomness of a sequence that consists of 100 cipher images of length 512 × 512 × 8 = 2,097,152 bits. They were generated by using different random secret keys. Table 11 presents the results for 15 tests and all of them passed these tests.

Conclusions
In this article, the IEGBNDS algorithm via Newton-Raphson's method and general Bischi-Naimzadah duopoly system (GBNDS) has been suggested. Newton-Raphson's method has been used for shuffling the rows/columns of the plain image. GBNDS has been used to producing chaotic sequences to diffusion phase of image encryption algorithm. The extracted chaotic sequences from the GBNDS is extremely random based on the NIST statistical tests. Many security experiments are applied to evaluate the efficiency of our algorithm. The IEGBNDS algorithm has a large key space (10 14(k+1) + 10 168 (>>2 100 ), the histograms of the generated cipher images are close to the uniform distributions, all entropy values for the cipher images based on IEGBNDS algorithm are close to 8, all correlation coefficient values for the cipher images are close to zero. The IEGBNDS algorithm outperforms some recent algorithms at least in one of the two measures, highly sensitive to small changes of the secret key, can be robust against the noise and data loss attacks, and can hold out against the plaintext attacks. In comparison to several recent algorithms, the IEGBNDS algorithm has a small running time. NIST statistical tests for 100 cipher images by the IEGBNDS algorithm are performed and all tests are passed. Finally, quantum image encryption algorithm based on GBNDS will be designed in the future to increase the security of the current algorithm.