{'fraction_non_alphanumeric': 0.043031292327996386, 'fraction_numerical': 0.019553363664779635, 'mean_word_length': 3.979937737806987, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
2D Hybrid chaos map for image security transform based on framelet and cellular automata

In this paper, we provide some safe ways to transfer images securely by using cryptography and steganography methods. In order to enhance the security of the image transmission, we introduce a new type of uniformly distributed 2D-hybrid chaos map based on Logistic, Sine and Tent maps, and use the cellular automata and discrete framelet transform in the proposed algorithms and also mix the position of the image pixels by apply kinds of shifts. To show that the proposed algorithms are able to resist various attacks, different types of simulation results and security analysis are used.


Introduction and Preliminaries
In the last decade, with the development of the social networks as WatsApp, Facebook, Instagram and etc., the importance of information security has increased. Since images play an important role in the social networks, creating a safe environment for transferring images is important. Encryption is one of the methods for safe transfer of image. Chaotic system is one of the most important tools in cryptography. Early studies on chaotic systems for encryption has been given by [1], and in recent years, this method has been used and developed in many papers [2,3,4,5]. Another tool used in cryptography is the cellular automata. This tool is introduced by Von Neumann [6,7] and is used in various articles for cryptography [8,9,10]. Steganography is the other method for image security transform. This method is used in many papers for image security transform [11,12]. The spatial domain and the transform domain are common methods in the steganography [13]. The Least Significant Bit (LSB) is considered as the main technique in spatial domain [14,15,16]. Another tool that is used in this article is the framelet transform. In 1952, the concept of frames for Hilbert spaces was defined by Duffin and Schaeffer [17]. Although the details of the framelet transform can be found in the [18], in the continue of this section, some basic relationships to this discussion are given. This type of transition has applications in various area of image processing such as deblurring, denoising [19,20]. In the present paper, in the first step, a 2D hybrid chaotic system has been introduced, then this system and the cellular automata method have been used in encryption algorithm. In the last step, an image hidden method based on the hybrid chaotic system and the framelet transform is introduced. The following subsections provide a brief overview of the basic principles.

Hybrid Chaos Map
The basic chaotic systems have some weaknesses. The nonuniform distribution and area limit of chaos behavior are the most important of these weaknesses. Combining these types of systems is one of the best ways to minimize these weaknesses. The first attempt to combine the two systems can be referred to Logistic Tent system (LTS) [21]. Subsequently, various methods have been introduced in the articles for hybrid systems, as Tent-Sine system [22] and 2D Sine Logistic modulation map (2D SLMM) [23].

Frame Theory
Let H be a separable Hilbert space. We call a sequence F = { f i } i∈I ⊆ H a frame for H , if there exist two constant A F , B F > 0 such that (1.1) If in (1.1), A F = B F = 1 we say that F = { f i } i∈I is a Parseval frame for H . Let F = { f i } i∈I be a frame for H , then the operator is well define and onto, also its adjoint is The operators T F and T * F are called the synthesis and analysis operators of the frame F. By composing T F and T * F , we obtain the frame operator The operator S F is a positive, self-adjoint invertible operator on H with A F .I H ≤ S F ≤ B F .I H , where I is the identity operator on H and A F and B F are the lower and upper frame bounds, respectively [18]. For Parseval frame F = { f i } i∈I , we have S F = I H .
Theorem 1.1. [18] Let F = { f i } i∈I be a frame for H with frame operator S F . Then In the proposed algorithm for image transform, we apply particular Parseval framelet systems in H = L 2 (R) that were constructed from B-spline whose refinement mask is h 0 = 1/4[1, 2, 1], with two corresponding framelet masks h 1 = 2/4[1, 0, −1] For the details of the image transform by using framelet, the reader can refer to [24,25].

Cellular automata
The cellular automata can be considered as a mathematical model for the discrete dynamical systems which composed of a number of cells. These cells together build a network, so that they are updated according to the special rules. In the following of this paper, the general principles used in the paper are explained and more details about this area can be found in [26,27]. In the proposed algorithms, we use the combined cellular automata. The combined cellular automata performance is like the common cellular automata, with the difference that the combined cellular automata can assign different rule number for each cell. The different dimensions can be classified for the cellular automata as one-dimensional, two-dimensional and threedimensional. In this paper, one-dimensional cellular automata has been used. Also for using the cellular automata, there is a need for boundary conditions. For the cellular automata, we can consider periodic, reflective, and fixed value boundaries as boundary conditions. In the proposed algorithms, periodic boundary condition as follows has been used.
where i , j , u and v denote cell coordinates in two-dimensional space of the size n × m and S is cell state at the time step t . Also, in this method, different neighbors are considered as the von Neumann neighborhood, the Moore neighborhood and the extended Moore neighborhood (see Fig. 1). In the proposed methods, the von Neumann neighborhood is used. The cellular automata are divided into two categories: reversible and irreversible. In the proposed key generation algorithm, irreversible cellular automata is used, and in encryption algorithm, reversible cellular automata is used.

Two dimensional hybrid chaotic system
In this section, we describe two-dimensional combination chaotic system based on Logistic, Sine and Tent maps. One-dimensional Logistic, Sine and Tent maps are  defined as follows [28]: 2) One of the two-dimensional chaos map is the Logistic map, which has the following form [29] Also in [23], 2D Sine Logistic modulation map (2D SLMM) is introduced as follows Each of the above maps has weaknesses that we will review. Flat histogram and uniform distribution are two most important features of the ideal chaos map for encryption process. Nonuniform distribution over output series can cause weakness in the decryption attacks as statistical attack. The most important and basic chaos maps as Logistic or Tent are not well enough to estimate these conditions. However, a good combination and transformation of these maps can satisfy these conditions. In the proposed hybrid chaos map, combining, transferring and adding weights are used. In the following, two combinational algorithms are used to obtain the hybrid chaos maps. The general outline of the combinational algorithms are presented in Fig. 2. In the first step of the combinational algorithms (a) and (b), x n and y n are used as inputs. Regarding the combinational algorithms (see Fig. 2), it can be seen that the difference between the two algorithms is in the input of the second step.
In the first algorithm, the output value of the first step (i.e. x n+1 ) and y n are used as input in the second step, but in the second algorithm, x n and y n are used as input values for the next step. The mathematical formulae for the algorithms can be expressed as follows ) mod 1, when y i ≥ 0.5, where x i+1 , for Algorithm (b). Consider the following cases:

Case (iii)
: , g x 2 (r, q, p) = exp(20r q) + sin(πr x), g y 1 (r, q, p) = p tan(r q), g y 2 (r, q, p) = cos(r q), In Case (ii) and Case (iii), F x 1 , F y 2 are considered as Logistic maps and F x 2 , F y 1 are considered as Sine maps. Results for the above cases are presented in Fig.s 3-6. In the Fig. 3, for the proposed hybrid chaos map, 2D Logistic map and 2D SLMM distribution patterns for 100 points are given. With regard to the results, it can be seen that the proposed maps have a uniform distribution compared to the other two maps. The histograms of output data are shown in Fig. 4. As seen from this figure, the histograms of 2D Logistic map and 2D SLMM are not flat, while the histograms of the proposed maps in comparison with two maps have a flat distribution. Also, cobweb plots in Fig. 5 show chaotic behavior for Case (i) and Case (ii). In this figure, 100 points generated by the chaos maps are used. Lyapunov Exponents is one of the most important value in the study of the behavior of the chaotic systems. Sensitivity to initial conditions can be studied by using this value. Different methods have been introduced in some articles to calculate this value, for example, the reader can see [30,31,32]. In this section, the method in [31] is used to find the Lyapunov Exponent. The relationship between Lyapunov exponent and chaotic system has been studied in various articles [33,34]. The following sentence is stated in [34]: "In an n dimensional dynamical system, we have n Lyapunov exponents. Each λ k represents the divergence of k-volume (k = 1 : length,k=2: area, etc.). The sign of the Lyapunov exponents indicates the behavior of nearby trajectories. A negative exponent indicates that neighboring trajectories converge to the same trajectory. A positive exponent indicates that neighboring trajectories diverge [34]". In Fig.6, 2000 points are generated by the chaos maps are used to calculate the Lyapunov exponents. According to the results in Fig. 6, it is seen that in the larger interval, in comparison with 2D Logistic map, the proposed hybrid map has chaotic behavior. Another convenient tool for chaos study is bifurcation diagram. The bifurcation diagram can be used to show chaotic attractors. The results for bifurcation diagrams are given in Fig. 6. Considering the above discussions, it can be concluded that the proposed chaos maps have good chaotic behavior such as flat distribution, sensitivity to initial condition and unpredictability of the output points.

Encryption and Decryption Algorithms
In this section, the details of the encryption and decryption algorithms are given.

Remark 3.1. In the reminder of this paper
and x j , y j ( j = 1, 2, ..., n) are chaos map outputs for initial values x 0 and y 0 . Also, ̟ τ 1 ,τ 2 (x 0 , y 0 , r, n) denotes ̟(x 0 , y 0 , r, n), which the decimal part of the numbers of the first row is cut from the τ 1 -th decimal number to the next digits and the decimal part of the numbers of the second row is cut from the τ 2 -th decimal number to the next digits.

Remark 3.2.
The outputs of the decryption by reversible cellular automata for x and y as inputs in the t − 1 and t times, respectively, rule number "r ule" and after "r ep" repetitions will be shown by [x ′ , y ′ ] := Φ(x, y, r ule, r ep). Also, the output of the decryption by irreversible cellular automata for x as inputs by rule number "r ule" and after "r ep" repetitions will be shown by x ′ := Φ(x, r ule, r ep).

Key generation function
One of the most important parts of an encryption algorithm is the key space. In this subsection, we describe the method of choosing the keys used in the algorithm. The keys used in the proposed algorithm are divided into three categories. A number of keys are selected as inputs with a fixed value, some of the keys are dependent on the input image and a number of keys are changed for each run of the algorithm. Therefore, the key space for the different images will be different. Also, for a fixed image, the key space for each implementation of the algorithm will be different. The following key space is used in the proposed algorithm.
where parameters r 1 , r 2 are consider as the parameter r , and x i 0 , y i 0 (i = 1, 2) are considered as starting value in the chaotic systems. In the encryption algorithm, r 1 and r 2 are considered as fixed key, and the rest of the key space are generated by using key generation function. The following algorithm is used as key generation function (It should be noted that matlab notation formats are used in the algorithms).
Step 1. Consider a color image I of the size n × m × 3, a text " Text " and inputs r 1 , r 2 .
If n is an odd number, then the last row of the plain image is repeated twice. In the next steps, the number of rows (i.e., n) is considered as an even number.
Step 2. Matrix Ψ of the size n×m×3 based on the chaos map and image I are obtained as follows: , r 1 , m (2, :); end for end for Step 3. By using the BITXOR operation, vector ξ 1 and ξ 2 are found by using the following algorithm. Step 4. The final vectors v 1 and v 2 are calculated as follows: Step 5. Key x 1 0 is considered as v 1 + v 2 (1, n/2)/2.
Step 6. By using x 1 0 and input text, the vector T is made by the following conditions. First, y 0 is defined as − If the input text size is smaller than m, then remaining parts will be filled using the following vector elements: − If the input text size is bigger than m, then T is found by Step Step 8. The vector v 3 is found by using the following algorithm.
Step 9. y 2 0 is defined as Also x 2 0 and y 1 0 are obtained as follows where x r and y r denote random numbers in the interval (0, 1).
The flowchart of the proposed key function is given in Fig. 7. The above algorithm can also be performed for grayscale and binary images by making some changes. For grayscale and binary images, in steps 2-3, k is considered equal to 1. Also, in step 4, w is changed as To check the key space sensitivity, numerical results for the above algorithm are presented in Table 1.

Encryption process
In this section, a color image of the size n × m × 3 is considered as an input image and the proposed algorithm for image encryption based on the 2D-hybrid chaos map and cellular automata is written as follows: Step1. Input image is divided into its own three plates.
Step2. First the odd columns of each plates are moved to the left hand and so the even columns are moved to the right hand, then the odd rows of each plates are moved up and so the even rows are moved down. By applying this processes twice, each plates are divide into sixteen segments and each parts can see as the small size of the input image. The output images of this step is seen as blocks matrix of the size 4 × 4. We show these block matrices by I k b , k = r, g , b.
Step3. The mixed block matrix I m b of the size 6 × 8, is achieved by using the following algorithm:  Step5. By using the following algorithm, the block matrix SI m b is separated into three matrices, named L,C and R : Step6. We take the matrices L,C , R, all together and carry out the shifting operation of the arrays of these matrices as follows: We shift the matrix L in a circular fashion (clockwise) and starting from the array L(1, 1). Note that in a shifting of the arrays of the matrix L, if we reach the last array in the shifting process, like the array L(e r , e c ), we will enter in the matrix C from the array C (e r , e c ), and continue shifting in a circular fashion (counter clockwise) and when we reach the array C (1, 1), we will enter in the matrix R from the array R(1, 1) and continue shifting in a circular fashion (clockwise) and if we reach the R(e r , e c ), we will enter in the matrix L from the array L(1, 1) and continue shifting again clockwise (see Fig. 8). We show these three obtained matrices by L s ,C s and R s , respectively. Step7. First of all, if n is odd number, we repeat the last row of each matrices L s ,C s and R s , one more time in the last of its, and so the number of the row will be even. Now, we continue our encryption algorithm by applying the cellular automata as follow (see Fig. 9): (i) All of the matrices L s ,C s and R s are converted to the binary matrices. (iv) By using the function "ci r cshi f t ", the array of the matrices is shifted to the right hand in the following way: Step (7)-(a) is repeated one more time.
We show these three obtained matrices by L r 1 , L g 1 and L b 1 , respectively.

Remark 3.3.
To encrypt a grayscale or a binary images, we can apply the steps 2, 6, 7 and 8. Just in the step 6, if we reach the last array in the shifting process, like the array I (e r , e c ), we will come back to the first array, i.e. I (1, 1), and continue shifting in a circular fashion (clockwise). As an example for step 6, in Fig. 10.b-c, an image where almost the center of it is changed to white, is used to simulate, and Fig. 10.a shows circular fashion shifting process for grayscale image.

Steganography
In this section, I is a RGB image of the size n × m × 3 and w is considered as a secret image of the size n ′ × m ′ , where n ′ m ′ ≤ nm/3. Step1. Input a cover image I and a secret image w.
Step2. Image I is divided into its own three plates and named them I k , k = r, g , b.
Step3. To avoid exorbitant shifts in the arrays of the matrix I , we use the function mod. We take the matrices I k , k = r, g , b all together and carry out the shifting operation of the arrays of these matrices as follows: First, we shift the matrix I r in a spiral fashion and starting from the array I r (1, 1) and continuing along the column of the matrix and the row of the matrix, respectively. Note that in a shifting of the arrays of the matrix I r , if we reach the last array of this matrix in the shifting process, we will enter in the matrix I g from the array I g (1, 1) and continue shifting in the same way and when we reach the last array of this matrix in the shifting process, we will enter in the matrix I b from the array I b (1, 1) and continue shifting in a the same way and if we reach the last array of this matrix, we will come back to the matrix I r from the array I r (1, 1) and continue shifting. We called this shift I . (See Fig. 11.(a)). Then, we considered these three obtained matrices again all together and start shifting similar to the above way, but starting from the last array I r (n, m) and continuing along the row of the matrix and the column of the matrix, respectively. We called this shift I I (see Fig. 11.(b)). We denote these three obtained matrices by I k s , k = r, g , b.
Step4. (i) We get the matrices I k s,d , k = r, g , b by applying the discrete framelet transform on the matrices I k s , k = r, g , b, and we cut the LL part of I k s,d , k = r, g , b, and named them I k s,d , k = r, g , b. (ii) In this step n ′′ and m ′′ are considered as row and column numbers of the output matrices in the part (i). First the odd and even columns of matrices I k s,d , k = r, g , b, are shifted ̟ 3,3 x 0 , y 0 , r, max(n ′ ′, m ′ ′) (1, j ) units up and down, respectively, then the odd and even rows of I m b are shifted ̟ 3,3 x 0 , y 0 , r, max(n ′ ′, m ′ ′) (2, j ) units right and left, respectively.
Step5. By considering the arrays of the matrices I k s,d , k = r, g , b and w as interger numbers, we converted these matrices to the binary matrices named b I k s,d , k =  r, g , b and bw, respectively. We set the most significant bits of the bw in the least significant bits of the b I k s,d , k = r, g , b as the following algorithm and the obtained matrices b I k s,d , k = r, g , b, is converted to the matrices with integer arrays.
Step6. First, the LL of the I k s,d , k = r, g , b, is replaced by b I k s,d , k = r, g , b and then, the inverse discrete framelet transform is applied on the achieved matrices and we put these matrices as the plates of the final image.
Similarly, we can do all the steps relevant to the forward part in the opposite way to get the secret image.

Remark 4.1.
For the steganography process of a grayscale or a binary images in a grayscale images, we can apply the steps 1, 3, 4, 5 and 6. Just in the steps 3 and 6, if we reach the last array in the shifting process, we will come back to the first array, i.e. I (1, 1), and continue shifting in a spiral fashion (see Fig. 12). (For more examples, we refer to Appendix section). Also, step 5 for grayscale in grayscale and binary in grayscale are as follows: −Grayscale in grayscale: end for end for end for −Binary in grayscale: j ); end for end for

Numerical experiments and security analysis
In this section, simulation results for the proposed algorithms are given. In the numerical results for space key, we use Table 1. Note that, case (iii) is used as the chaos map in the proposed algorithm. Also, in order to show the performance of the proposed algorithms, the results are compared with the results of other papers.

Simulation results of the encryption algorithm
The security analysis of the proposed algorithm are studied in this subsection. Also, the results for encryption proposed algorithm are given in Fig. 13.

Security key space
One of the most important components of the encryption algorithm is key space.
The key space in the proposed algorithm has a dynamic structure i.e., when a bit of the input image is changed, the key space changes, also, a different key space is used for each algorithm implementation. In Fig. 14, the proposed algorithm is run twice on the parthenon image. In these results, the key spaces 21 and 22 from Table  1 are used. To show the difference between the two images, pixel-to-pixel difference is given in Fig. 14. The results show, the two images are very different. Therefore, it can be concluded that the proposed algorithm is able to resist the chosen-plain text attack. Also, key size is important item in key space. Key size plays an important role in attacks. The relationship between key size and brute force attack has been studied in [35]. According to this study, if key space is larger than 2 100 , then the algorithm can withstand the brute force attack. The key space in the proposed algorithm consists of six keys. Therefore, if in the image encryption algorithm, the precision of the key size is equal to 10 −15 , then the key space is 10 90 = 2 90 log 2 10 ≈ 2 298 , therefore the key space for resistance against the brute force attack will be sufficient enough. As last study in this subsection, the key space changes is studied in the decryption process. By applying small changes on the key space 5 from Table 1, two keys are created as follows  Fig. 15.a, lena image is encrypted by K 5 (key space number 5, from Table 1), in Fig. 15.b, the decryption process is run by K 5 , also in the Fig.s15.c-d, the decryption process are run by K 5 and K 5 , respectively. Therefore by small changes in the keys, we can not decrypt the image. Table 7 shows that the key space size of the proposed algorithm is bigger than the key space size of the compared algorithms. Proposed algorithm Ref. [36] Ref. [37] Ref. [38] Key space size 10 90 ≈ 2 298 10 84 2 120 10 56

Statistical analysis
In this subsection, statistical analysis including correlation values, information entropy and histogram analysis are studied. The correlation values for image can be found by using following formula from [39] where E , µ and σ denote expectation, mean values and standard deviation, respectively. The correlation values for different images are given in Table 3. By using results in this table, we can see that the original images have high correlation values, while encrypted images have low correlation values. Also, Fig. 16 shows correlation  distributions for the original images and encrypted images. Comparison results of the proposed algorithm with the algorithm in [40], that are given in Table 4, illustrates the advantage of the proposed algorithm. The information entropy is calculated by where w and P represent the gray level and the probability, respectively. The values of this expression are in the interval [0,8], and the ideal value for the encrypted image is equal to 8. Numerical results of the information entropy for different images are shown in Table 3. By using these results, we can say that the information entropy for encrypted images are close to the ideal value. Also, the comparison results for the information entropy are presented in Table 5. Histogram diagram for original and encrypted images are given in Fig. 13. In this figure, we can see that encrypted images have a flat distribution compared to the original images.     [41] 7.9891 7.9898 7.9899 Algorithm in [42] 7.9896 7.9893 7.9896 Algorithm in [43] 7.9893 7.9896 7.9903 Algorithm in [44] 7.9874 7.9872 7.9866 Algorithm in [45] 7.9278 7.9744 7.9705

Sensitivity analysis
NPCR and UACI are two important tools in sensitivity analysis. NPCR (i.e., number of pixels change rate) represents the number of pixels change rate while one pixel of plain image changed and UACI (i.e., unified average changing intensity) denotes the average intensity of difference between the plain image and encrypted image. A good study based on statistical discussions for these values is presented in [46]. The ideal value for NPCR and UACI are considered as 100% and 33.33%, respectively.
Using these values, the resistance against differential and plaint text attacks can be studied. When these values are close to the ideal values, we can say that the encryption algorithm is more sensitive to the changing of plain image, therefore the encryption algorithm can effectively resist plain text and differential attacks. By using numerical results in Table 3, we can see that results are close to the ideal value. As well as, the comparison results for NPCR and UACI values have been tabulated in Table 6. In computing, NPCR and UACI are considered as follows where, C 1 and C 2 are considered as the encrypted image before and after the original image is changed.

Noise and data loss attacks
The purpose of some attacks is not decryption, and the purpose is to destroy information, like noise and data loss attacks. In these attacks, parts of the information may be lost. In the proposed algorithm, the location of pixels are changed, and this can be a response to these attacks. The simulation results for these attacks are given in Fig.s 17-18. In the Fig. 17, the results show that the proposed algorithm has better results than the algorithm in [50]. Also, in Fig. 18, for different values of noise density, results are presented. By using the results, it is seen that the encrypted images are recognizable. Therefore, we can say that the proposed algorithm can resist noise and data loss attacks.

Simulation results of the steganography algorithm
In this section, the results of the proposed steganography algorithm are given. In Fig.  19, we apply the proposed algorithm on lion(80 × 80) and MRI(250 × 250) images as secret and cover images, respectively. According to the proposed algorithm, first of all, we shift the cover image by using two types of the spiral fashion shifting (I and II) after 1000 shifts (Fig. 19.c). Next, we use discrete framlete transform (DFT) (Fig.  19.d). Next, we cut the LL part of DFT (Fig. 19.e). Then in Fig. 19.f, the odd and even columns are shifted up and down and the odd and even rows are shifted right and left by applying x 0 = 0.1, y 0 = 0.3 and r = 0.2 as input values for the proposed chaos map for details, we refer to step4 (ii) . Note that we can use the proposed key generation function to get x 0 , y 0 and r . Finally, we set the most significant bits of the secret image in the least significant bits of the obtained image from the previous step (see step5). By doing the above processes conversely, stego image ( Fig. 19.g) is obtained. To show the resistance of the proposed algorithm against the data loss attacks, the simulation results for data loss attacks are given in Fig.s 19.i-l, where once the 40 × 40 size of the central part and once again in the size of the secret image, i.e. 80 × 80, of the corner part of the stego image are removed.  Fig. 19.g Fig. 19.h Fig. 19.j Fig. 19

Appendix
In this section, to make the visualization of the proposed steps easier, we present some examples. Fig. 20 represents the circular fashion shifting in the proposed encryption process. For better understanding, we apply this algorithm on an image of the size 256 × 256, that almost the center of this changed to orange color.

Conclusion
In this paper, by introducing a 2D-hybride chaos map, safe ways to transfer images securely by using cryptography and steganography methods based on this chaos map are presented. Also, in the proposed algorithm , framelet, cellular automata and kinds of shifts have been used to increase the resistance against different attacks. By using simulation, results, we can say that the proposed algorithms can effectively resist differential, statistical, noise, data loss and chosen-plain text attacks.