New Chaotic System: M-Map and Its Application in Chaos-Based Cryptography

: One of the applications of dynamical systems with chaotic behavior is data encryption. Chaos-based cryptography uses chaotic dynamical systems as the basis for creating algorithms. The present article discusses a new dynamical system called M-map with its analysis: ﬁxed points, bifurcation diagram, Lyapunov exponent, and invariant density. The obtained bifurcation diagram and the plot of the Lyapunov exponent (with a minimum value of ln2 and a maximum value of ln4) suggest that the so-called robust chaos characterizes this map. Moreover, the obtained results are compared with other dynamical systems used in cryptography. Additionally, the article proposes a new image encryption algorithm. It uses, among others, cyclically shifted S-box or saving encrypted pixels on the ﬁrst or last free space in the cipher-image. The conducted analysis shows that the cipher-images are characterized by an entropy value close to 8, a correlation of adjacent pixels value close to 0, or values of Number of Pixel of Change Rate ( NPCR ) and Uniﬁed Average Changing Intensity ( UACI ) measures close to 100% and 33%, respectively.


Introduction
Dynamical systems with chaotic behavior describe many physical phenomena. Their particular application is cryptography based on the chaos theory, which uses these types of recurrences to keep data secure [1][2][3]. This is possible due to the properties of chaotic maps, such as random-like behavior and sensitivity to changing initial conditions and, at the same time, the deterministic method of obtaining successive states. In chaotic cryptography, the values of the initial conditions and parameters are treated as secret keys.
The vast majority of scientific publications in the area of using chaos in cryptography focus on defining new algorithms that will be used to keep data secure based on the selected chaotic system. Many of these algorithms turn out to be ineffective or even dangerous [4][5][6][7][8][9]. On the other hand, sparse works have focused on dynamical systems, which are a significant part of the encryption process. Of course, new systems appear in the works mentioned above; however, they are often treated as additions to the algorithms.
Chaotic cryptography requires a dynamical system that is appropriate from its point of view. Such a system should be characterized, among others, by a large range of values of initial conditions and parameters for which chaos can be observed. In addition, the distribution of the iterated variable of such systems should be flat to make it impossible to perform statistical analysis.
In the professional literature, multi-dimensional chaotic dynamical systems, such as the Lorentz system [10,11], Henon map [12], discrete memristor hyperchaotic maps [13], two-dimensional sine logistic modulation map [14], or memristive Rulkov neuron model [15], have been used in chaotic cryptography. The use of such mappings increases the number of calculations to obtain the next state of the system, which results directly from their complicated structure [16]. For this reason, one-dimensional mappings of the following form are often used for encryption: where f : [0, 1] → [0, 1] is a given function. Chaotic cryptography uses only chaotic systems. Therefore, it is necessary to determine whether the given system meets this condition. One of the measures determining whether the mapping of the form (1) generates chaotic orbits is the Lyapunov exponent defined by the formula The value of the Lyapunov exponent determines whether the obtained orbit is stable (λ ≤ 0) or whether the trajectories starting from close initial conditions diverge after some time (λ > 0). It should be emphasized that condition λ > 0 is only a necessary condition for chaos to occur. Another valuable feature of dynamical systems is the so-called invariant density, which from a practical point of view is the distribution of the iterated variable, which can be obtained by solving the Frobenius-Perron [17,18] equation. Both the Lyapunov exponent value and the invariant density are normally obtained numerically.
Examples of systems (1) that are commonly used in recent years in chaotic cryptography are the logistic map [1, [19][20][21][22][23][24][25][26][27][28][29], (skew or asymmetric) tent map [19,21,25,27,[30][31][32], or sinus map [19,25,28,33]. However, from a cryptographic point of view, the mentioned mappings have properties not entirely suitable for use in such applications [34]. This is evidenced by, for example, the logistic map, which is the most frequently used dynamic system in the professional literature. For this reason, this article presents a new dynamical system characterized by chaotic behavior. Its properties are much better than in the case of the mappings mentioned above. In addition, this article analyzes, among other things, the Lyapunov exponent and the potential applications for data encryption of the presented system.
The main contributions and novelty of this article are (i) the development of a new dynamic system that can be used in chaotic cryptography, (ii) the presentation of a new image encryption algorithm, and (iii) the development of a simple S-box algorithm which is part of the encryption process.
This article is structured in the following order-the first part, the Introduction, outlines the topics. In Section 2, some mappings often used in cryptography are shown. Section 3, which is the Model section, shows the M-map equation. Section 4 presents the analysis, which shows inter alia, fixed points, bifurcations, Lyapunov exponent, and the invariant density. Then, in Section 5, a new image encryption algorithm with its analysis is shown. The last sections include the Conclusion and References.

One-Dimensional Mapping Used in Cryptography
In chaotic cryptography, one-dimensional mappings are particularly popular. The most frequently used dynamic systems of this type are presented below.
Equally often, in scientific publications on chaotic cryptography, the asymmetric tent map is used, which is given by the following formula [19,21,25,27,[30][31][32]: where p ∈ (0, 1). This mapping for each value of the p parameter has a chaotic solution with a positive Lyapunov exponent. Another mapping that is used in chaotic cryptography is the sine map, which can be defined by the following equation [19,25,28,33]: where a ∈ [0, 1]. This system has very similar features to the logistic map. The above list can be enriched with other one-dimensional dynamical systems, such as a Gauss map [37,38]. However, their values are not specified in the [0, 1] interval; therefore, they are not taken into account in the comparative analysis in this article.

The M-Map
This article introduces a new model of a one-dimensional chaotic map, which has been named M-map. The recursive equation of the M-map is determined by the following formula: where p ∈ [0.25, 0.5]. Figure 1 shows the M-map graphically. This figure shows that this system looks like the letter "M" and, hence, the name of this map: M-map. Moreover, it can be observed that when the p parameter changes from the value of p = 0.25 to p = 0.5, the form of the map changes from two parabolas to the letter "M" to switch finally to the logistic map for p = 0.5. It can also be easily seen that this map is symmetric about the line x = 1 2 .

Analysis
The analysis of the dynamical system (6) was divided into several subsections. It deals with fixed points, bifurcation diagram, Lyapunov exponent, and invariant density.

Fixed Points
One of the elements of the analysis of dynamical systems is the determination of their fixed points, i.e., such values x * for which the following equation holds In the case of M-map, we distinguish the following cases: • For p ∈ 1 4 , 1 − √ 2 2 : x * ∈ 0, −p 2 + p, For p ∈ 1 − √ 2 2 , 1 2 : The calculated fixed points are shown in Figure 1.

Bifurcation Analysis
The bifurcation diagram shows the solutions of the system depending on the value of its parameter. For M-map, the bifurcation diagram of the mapping is shown in Figure 2. It can be read that the M-map has no visible periodic windows, which makes the behavior of the dynamical system in this area chaotic. Moreover, the iteration variable density for the given p parameters is noticeable. The darker area around the values of 0 and 1 means that there is a greater accumulation of the mapping values. Thus, the density of the M-map will have a U-like shape similar to the logistic map density. This observation was confirmed in the analysis of the invariant density in Section 4.4.

Lyapunov Exponent
The Lyapunov exponent is a measure of the chaotic nature of a dynamical system and can be determined using Formula (2). Its positive value is necessary for a dynamic system to behave in a chaotic manner.
For the M-map, its graph is shown in Figure 3. This plot confirms that this mapping does not have the so-called periodic windows. Moreover, the shape of the Lyapunov exponent curve is interesting-it is not fractal. In this case, as in the case of Weierstrass recurrence [39,40], its shape is smooth. This phenomenon occurs in so-called robust chaos [41].
The value of the Lyapunov exponent directly translates into the sensitivity of the dynamical system to changes in the initial condition. The greater the value of the Lyapunov exponent, the faster the trajectories starting from very close initial conditions diverge. This process can be seen in Figure 4.

Density of the Iterated Variable
Invariant density allows determining the probability distribution of the iterated variable. It can be determined from the Frobenius-Perron [17,18] formula. However, as a rule, determining it in an analytical manner is difficult or even impossible. For this reason, it is approximated numerically using histograms.
Graphs of the numerically obtained densities for the selected p parameter values are shown in Figure 5. The lower right graph shows the invariant density of the logistic mapping for the value of the parameter a = 4, which can be determined by the following formula The densities for the remaining cases still resemble the "U" shape. However, their shape is not perfectly equal to (8).

Comparative Analysis
The dynamic systems used in the construction of cryptographic algorithms must have appropriate properties. These properties include, among others, the largest possible range of parameter values and initial conditions for which chaos occurs. Looking at the graphs of both the bifurcation diagram in Figure 2 or the Lyapunov exponent in Figure 3, it can be seen that the interval in which chaos occurs is within the value of the parameter p ∈ [0.25, 0.5]. At the same time, it is worth emphasizing that there are no periodic windows, which appear in many dynamic systems with chaotic behavior. The analysis also shows that the Lyapunov exponent has a stable value, i.e., its value does not change significantly for values close to the parameter value. Such a situation is also very desirable from the point of view of chaotic cryptography. Moreover, the density of the iterated variable resembles the letter "U" similarly to the logistic mapping ( Figure 5). This means that the density of this mapping is flat in the middle and relatively symmetrical and, thus, can be used to generate pseudo-random values. Table 1 compares the proposed M-map mapping with logistic, skew tent, and sine map. A similar juxtaposition is shown in Figure 6. As criteria, aspects important in chaotic cryptography were selected, i.e., the range of parameter values for chaos, the value of the Lyapunov exponent, and the map density. The range of M-map values for which there is chaos is comparable to the other mappings. However, in the case of the logistic map and sine map in the given ranges, there are the so-called periodic windows. This means that by selecting the parameter value, there is a risk of hitting the periodic window and thus obtaining a periodic solution. This situation is, of course, very undesirable from a cryptographic point of view.
The value of the Lyapunov exponent confirms the range of parameters for which there is chaos. Only M-map and tent map are consistently positive of the four compared mappings. In the case of the tent map, its value can be determined using the following formula Despite the fact that its value is constantly greater than zero, for values of p close to 0 and 1, its value is close to zero. In such cases, numerically obtained trajectories of the tent map (4) lose their properties (e.g., uniform density) [42]. On the other hand, the Lyapunov exponent for M-maps proceeds from ln 2 for p = 0.5 to ln 4 at p = 0.25. Additionally, for all mappings that consist of only two arms, the maximum value of the Lyapunov exponent is ln 2. In this respect, the M-map representation has by far the best features. On the other hand, in the case of invariant density, the best mapping for chaotic cryptography is the tent map. The distribution of this mapping is uniform over the entire range of p parameter values. On the other hand, the M-map has a "U" -like density. A similar shape of the density function also has the logistic map but only for the value of the a parameter close to 4, which is given by the Formula (8).
Moreover, it is possible to improve the density of the proposed mapping in such a way that its shape resembles the density with the given Relation (8). This procedure may consist in changing the mapping parameter according to the adopted scheme. It is possible to use, e.g., the following scheme. x The distribution of the mapping obtained as a result of the operation of the above procedure is presented in Figure 7. In this graph, it can be seen that the map density approximates the density (8) better than it does for single parameter values (see Figure 5). The above comparison shows that the M-map can replace the logistic map and other one-dimensional chaotic maps in cryptography applications.

Simple Image Encryption Algorithm
A simple encryption algorithm was developed to demonstrate the use of the M-map that depicts the image's encryption. This encryption procedure is based on using a dynamic S-box and saving the encrypted pixels in the appropriate place in the cipher-image. The S-box dynamics consist of its dynamic shift for each encrypted pixel. Moreover, successive pixels are stored in the first free position from the beginning or end of the cipher-image. The value of the M-map determines which variant is selected.

Image Encryption Algorithm
The proposed image encryption algorithm operates on pixels in RGB encoding. Hence, it is required that the images be in this format. The next steps are Algorithm 1.
The general scheme of the encryption algorithm is shown in Figure 8. From the set {0, 1, · · · , 255}, generate an S − box; 3.
For every pixel value px(i, j): (a) Calculate x from (6) (x = f (x, p)); (b) Calculate shi f t = f loor(256 · x) and shift the S-box in a cyclic way by the value shi f t; (c) Read the S − box value for the pixels RGB components (S − box(px(i, j))); (d) If x ≤ 0.5 : write value S − box(px(i, j)) in the first free place in the cipher-image; (e) If x > 0. 5 : write value S − box(px(i, j)) in the last free place in the cipher-image.
In step 3b of the encryption algorithm, the shi f t value for the S-box shifting is calculated. Examples of such an S-box and its shifted version are shown in Table 2. Table 2. S-box and shifted S-box by the value of n.

Decryption Algorithm
Decryption algorithm is shown in Algorithm 2

Algorithm 2 Decryption Algorithm
1. Set the keys: x and p; 2.
When not all pixels are read: (a) Calculate x from (6) (x = f (x, p)); i. If x ≤ 0.5 : read the first free pixel px; ii. If x > 0.5 : Read the last free pixel px; (b) Find the S − box indexes for the RGB components of the pixel px (c) Calculate shi f t = f loor(256 · x) and shift the S-box in a cyclic manner by the value shi f t; (d) Write the read indexes in the first free place in the plain-image.
The general scheme of the decryption algorithm is shown in Figure 9.

S-Box Generation
The S-box should be generated in the second step of the proposed encryption algorithm. For this purpose, known from the literature, methods of generating permutations with, for example, chaotic mappings can be used. This article proposes a procedure that is based on generating permutations using the Fisher-Yates algorithm. More about the Fisher-Yates method itself, as well as its variants concerning the use of chaotic mappings, can be found in [43,44].
The proposed algorithm uses the tent map (4) due to uniform distribution. However, the M-map can also be used for this purpose even despite a non-uniform distribution (see Figure 7). A flat distribution from such values can be obtained by using, e.g., the procedure described in [45].
Preliminary assumptions: Let Sn be a list consisting of [0, 1, . . . , 255], length Sn represents its length, Sb is an empty list, N and M are the image dimensions: 1.
Calculate the value of S px , which is the sum of all pixels of the plain-image. S px is the private key of the S-box;
The S-box generation algorithm depends on the value of S px . This means that this value must be passed as a secret or public key. An incorrect value of S px entered for decryption will result in receiving another S-box; thus, the cipher-image will not be decrypted correctly. If the value of S px is treated as a secret key, then the number of all such keys is equal to 3 · 255 · N · M. For an image with dimensions of 512 × 512, the number of all possible keys is 200540160. For the selected test images and their cipher-images, an analysis was carried out in the next subsections. The diagram of this analysis is shown in Figure 13.

Key Sensitivity Analysis
A secure cipher should be sensitive to changes of the key values. To encrypt the image of Lena (Figure 10a), parameter p = 0.352 values was chosen, while the initial condition is set to x 0 = 0.789. The key resulting from the S-box generation algorithm is equal to 100842898. The images obtained with a tiny change of one of the keys are visible in Figure 14. Figure 14a is obtained for initial condition x 0 = 0.789 + 10 −16 . In turn, Figure 14b is obtained for the map parameter equal to p = 0.352 + 10 −16 . Finally, Figure 14c is obtained for the key obtained from the S-box equal to 100842897. In each of the above cases, the keys used differ from the correct ones by a tiny value. However, the recovered images are completely different from Lena's image from Figure 10a.

Histograms
The simplest analysis of an encryption algorithm is to analyze the cipher-image histogram. The histogram of the cipher-image should be perfectly flat to make any statistical analysis impossible. In the case of a color image, such an analysis applies to each of the channels, i.e., it is performed separately for the pixels representing the red channel, separately for the green channel, and finally for the blue channel. The results obtained from this analysis for the original images and cipher-images are presented in Figures 15-17. From these figures, it can be seen that the histograms of the encrypted images for each channel are flat. From a cryptographic point of view, this is the most appropriate situation.  (Figure 10a (top row)) and its cipher-image (Figure 10b (bottom row)). (Figure 11a (top row)) and its cipher-image (Figure 11b (bottom row)). Figure 17. Histograms of Baboon (Figure 12a (top row)) and its cipher-image (Figure 12b (bottom row)).

Differential Attack Analysis
NPCR (Number of Pixel of Change Rate) and U ACI (Unified Average Changing Intensity) are two crucial measures of the algorithm's resistance to differential attacks. To determine them, we need two encrypted images E 1 and E 2 , for which its plain-images P 1 and P 2 differ from each other for only one randomly selected pixel. Furthermore, E 1 and E 2 are received using the same values of keys.

NPCR Analysis
The NPCR value is calculated from the following formula: where the following is the case: and N × M denotes the image dimensions, and E * (i,j) is the pixel in the (i, j) coordinates of the E * image. The ideal value for NPCR is 100%. In practice, NPCR close to 100% means that the encryption algorithm is resistant to differential attacks. The results for the cipher-images are presented in Table 3. The numerical values in this table are close to the ideal value, which concludes that the proposed algorithm is resistant to differential attacks. Table 3. NPCR values for test cipher images. The first column is the image, and the next one is the NPCR value for the Red, Green, and Blue channels. The U ACI value is calculated from the following formula:

Image
and N × M denotes the image dimensions, and E * (i,j) is the pixel in the (i, j) coordinates of the E * image. The desired value for U ACI is 33%. The results for the cipher-images are presented in Table 4. The numerical values in this table are close to the ideal value, which concludes that the proposed algorithm is resistant to differential attacks.

Entropy
Entropy measures the amount of information in the source. The greater its value, the more information this source carries with it. It can be calculated with the formula: where p(m i ) is the probability of element m i in message m. In the case of images, m i is understood as the pixel value for a specific channel, i.e., it takes the value from the set {0, 1, · · · , 255}, while p(m i ) is the probability of m i in a given channel, in all pixels of the image. For m defined as above, the entropy has a maximum value of 8. This case means that all probabilities of p(m i ) are equal to 1 256 . The entropy results for the test images are presented in Table 5. The obtained results show that the entropy for the cipher-images is close to 8. Table 5. Entropy value for test cipher images. The first column is the image, and the next one is the entropy value for the Red, Green, and Blue channels.

Image
Red Green Blue

Correlation Analysis for the Adjacent Pixels
Pearson's correlation coefficient r can be used to determine the correlation between pixels. It is is given by the following formula: where the following is the case: Cov(x, y) x and y are consecutive image pixels with dimensions N × M. The results of the r correlation coefficient for the cipher-images are presented in Table 6. The obtained values of the r coefficient are close to zero, which means that the cipher-image pixels are not correlated. The lack of correlation applies to adjacent pixels in the horizontal, vertical, and diagonal arrangements.

Comparative Analysis
To illustrate the proposed algorithm against the background of encryption procedures, Lena's image and measures for its cipher-image from the publication [46][47][48] were selected. And so, the Table 7 shows the values for NPCR, Table 8 shows the comparison for the U ACI measure, Table 9 shows the entropy, while the Table 10 shows the correlation coefficient for adjacent pixels. These Tables show that the values obtained for Lena's image from the proposed algorithm and those cited in the literature are similar. And so, looking at the NPCR value in the Table 7 in the case of [47,48] publications, the obtained values are very similar. In the case of the U ACI measure, the result from work [47] is very similar again, but those from work [48] are already much worse (close to 49%) than the proposed algorithm. In the case of the entropy values presented in Table 9, all compared values are similar, although the closest values to the optimal value 8 are those from the proposed algorithm. Table 10 shows the correlation values for adjacent pixels for the compared works. Both the proposed algorithm and those from [47,48] have values very similar, close to the optimal value of 0.  Table 9. Comparison of the entropy values for cipher-images components of Lena from different publications. The first column is the image, and the next one is the entropy value for Red, Green, and Blue channels.

Image
Red Green Blue Table 10. Comparison of correlation coefficient values (r) for cipher-images components of Lena from different publication. The first column is the image, and the next one is the correlation coefficient value for the RGB channels of the horizontal, vertical, and diagonal adjacent pixels.

Conclusions
The article proposes a new dynamical system for cryptography applications based on the chaos theory. To confirm its usefulness, the analysis of fixed points, bifurcation, Lyapunov exponent, and invariant density was performed. The analysis shows that the so-called robust chaos characterizes the proposed dynamic system, i.e., there are no periodic windows. Moreover, both the Lyapunov exponent's stable value and the iterated variable's density suggest that this mapping can be used in chaotic cryptography applications. Additionally, the proposed mapping was compared with logistic, tent, and sine maps. The obtained results show its better features concerning other compared dynamical systems.
The article also introduces a new image encryption algorithm. It uses, among others, S-box, which is cyclically shifted and saves encrypted pixels in the cipher-image in the first free place from its beginning or end. However, it is required that the images be saved in RGB color format. The algorithm was tested on the images of Lena, Baboon, and Pepper, for which color histograms, NPCR and U ACI measures, entropy, and correlation analysis for the adjacent pixels are presented. These values are successively almost equal to the following: 8 for the entropy, 0 for the correlation of adjacent pixels, 100% for the NPCR, and 33% for the U ACI. The obtained values show that this simple algorithm can be used in practice to encrypt images.