# Cryptanalysis of a New Color Image Encryption Using Combination of the 1D Chaotic Map
## 3 Chosen-Plaintext Attack
### The Second Phase of Attack  
In the following description \(m\), \(n\) and \(\mu\) are all positive integers. The plaintext sequences need to be divided into block. \(S\), \(R\) and \(U\) represent the plaintext sequence in one division. The process of attacking permutation is as follows. Step 1: Consider a plain sequence \(S\) and set it:  
\[S=[S\{0\},\,S\{1\},\ldots,S\{i\}\ldots S\{\Omega-1\}]\,2\leq\Omega\leq 256 \tag{21}\]where \(S[i]=[i,i,\ldots i]_{l_{1}}\), \(l_{1}=M\times 3N/\Omega\) and call \(S[i]\) first order sub-block. Convert \(S\) into the R, G and B color image with the size of \(M\times N\) and the permutation sequence \(P_{S}\) corresponding to \(S\) can be obtained after the first phase. Step 2: Choose pixel \(P_{S}(j)\). If \(P_{S}(j)=m\), the pixel in \(S\) corresponding to \(P_{S}(j)\) would be one pixel which is in \(S[m]\). Register the position of \(j\) in Set \(INDEX[m]\). All the pixels of \(P_{S}\) would be registered in one set. Step3: Consider a plain sequence \(R\) of size \(M\times 3N\) and divide it into \(\Omega\) first order blocks \(R(i)\), \(i=0,1,...,\Omega\). Divide each block into \(\Omega\) second order blocks \(R[i]\{j\}\)\(j=0,1,...,\Omega\) and set:  
\[R[i]\{j\}=\left[j,j,\ldots j\right]_{l_{2}},\ l_{2}=M\times 3N/\Omega\Omega \tag{22}\]  
The permutation sequence \(P_{R}\) corresponding to \(R\) can be obtained after the first phase. Step 4: Choose pixel \(P_{R}(t)\in Index[m]\). If \(P_{S}(t)=n\), the pixel in \(R\) corresponding to \(P_{R}(t)\) would be one pixel which is in \(R[m]\{n\}\). Register the position of \(t\) in set \(Index[m]\{n\}\). All the pixels of \(P_{R}(t)\) would be registered in one second order set. If \(l_{2}=1\), each \(Index[m]\{n\}\) would include only one element and we can get all the corresponding permuted positions corresponding the elements in \(R\). If \(l_{2}>1\), repeat Step 3, 4 until the element quantity of \(l=1\) and get the position matrix X'. The number of times of divisions is \(f\) and \(f=\text{ceil}\Big{(}\log_{\Omega}(M\times 3N)\Big{)}\). The permutation attack process can be expressed as in Algorithm 2. ```
1: the plain sequence \(S\) from the first division and encrypt \(S\)
2:\(P_{S}\leftarrow\) the first phase
3:\(INDEX[m]\gets check\ P_{S}\)
4: set the plain sequence \(R\) from the second division and encrypt \(R\)
5:\(P_{R}\) from the first phase
6:\(INDEX[m]\{n\}\gets check\ P_{R}\)
7:repeat further division until the element quantity \(l=1\)
8:\(INDEX[m]\{n\}\cdots\{\mu\}\leftarrow\) check the last permuted matrix
```  
**Algorithm 2** Permutation Attack  
For clarity of the relationship of \(f\), \(\Omega\) and image size, some values of \(f\) are shown as Table 1. \(f\) ascends when \(\Omega\) descends and image size ascends according to Table 1.  
If the size of I is \(256\times 256\) and \(\Omega=256\), \(f=3\). At the first time of division the plaintext sequence \(S\) can be set as:  
\[S=\left[\left(0\,0\,\cdots\,0\right)_{256\times 3}\left(1\,1\cdots 1\right)_{256 \times 3}\left(2\,2\cdots 2\right)_{256\times 3}\cdots\left(255\,255\,\cdots 2 55\right)_{256\times 3}\right]_{256\times 256\times 3} \tag{23}\]  
At the second time of division the plaintext sequence \(R\) can be set as:  
\[R=\left[\left(0\,0\,0\right)\left(1\,1\,1\right)\cdots\left(255\right)\left(0 \,0\,0\right)\left(1\,1\,1\right)\cdots\left(255\right)\,\cdots\left(0\,0\,0 \right)\left(1\,1\,1\right)\cdots\left(255\right)\right]_{256\times 256\times 3} \tag{24}\]  
At the third time of division the plaintext sequence \(R\) can be set as:  
\[U=\left[\left(0\,1\,2\right)\left(0\,1\,2\right)\cdots\left(0\,1\,2\right) \right]_{256\times 256\times 3} \tag{25}\] \begin{table}
\begin{tabular}{c c c c c c c} \hline
**Image Size** & \(\Omega\)**=256** & \(\Omega\)**=128** & \(\Omega\)**=64** & \(\Omega\)**=32** & \(\Omega\)**=16** & \(\Omega\)**=8** \\ \hline \(256\times 256\) & 3 & 3 & 3 & 4 & 5 & 6 \\ \(512\times 512\) & 3 & 3 & 3 & 4 & 5 & 6 \\ \(1024\times 1024\) & 3 & 3 & 4 & 4 & 5 & 7 \\ \hline \end{tabular}
\end{table}