# A Tweak-Cube Color Image Encryption Scheme Jointly Manipulated by Chaos and Hyper-Chaos
## 3 The Proposed Image Cryptosystem
### Key Stream Generation
\right., \tag{14}\]  
The resulting four sequences are treated as key streams that can be expressed as \(\mathrm{K}_{1}(\mathrm{\check{x}}_{21}(\mathrm{k}))_{\mathrm{k}=1}^{\mathrm{m}}\), \(\mathrm{K}_{2}(\mathrm{\check{x}}_{22}^{\prime}(\mathrm{k}))_{\mathrm{k}=1}^{ \mathrm{n}}\), \(\mathrm{K}_{3}(\mathrm{\check{s}}_{1}^{\prime}(\mathrm{k}))_{\mathrm{k}=1}^{ \mathrm{m}}\) and \(\mathrm{K}_{4}(\mathrm{\check{s}}_{When the computed values \(\lambda_{\text{R,G,B}}(i)=0\), the \(\text{P}_{\text{R}}\), \(\text{P}_{\text{G}}\), and \(\text{P}_{\text{B}}\) matrixes are respectively cyclically shifted to the left by \(\text{K}_{1}(\hat{\text{x}}_{21}(k))_{k=1}^{m}\) positions, where \(k=i\). Then, when \(\lambda_{\text{R,G,B}}(i)=1\), the cyclic shifts are performed correspondingly to the right \(\text{K}_{1}[\hat{\text{x}}_{21}(k)]_{k=1}^{m}\) positions. As shown in Figure 4, similar to the principle of Rubik's Cube, the pixels of the image can also be rotated and shifted to the left and right. Step 3: For each column of \(\text{P}_{\text{R}}\), \(\text{P}_{\text{G}}\), and \(\text{P}_{\text{B}}\), the operations are as follows:  
\[\left\{ \begin{array}{l}\lambda_{\text{R}}(j)=\sum_{i=1}^{m}\text{P}_{\text{ R}}(i,j)\text{mod m}\\ \lambda_{\text{G}}(j)=\sum_{i=1}^{m}\text{P}_{\text{G}}(i,j)\text{mod m}\\ \lambda_{\text{B}}(j)=\sum_{i=1}^{m}\text{P}_{\text{B}}(i,j)\text{mod m}\\ \end{array} \right. \tag{16}\]  
When the calculated values \(\lambda_{\text{R,G,B}}(j)>128\), the \(\text{P}_{\text{R}}\), \(\text{P}_{\text{G}}\), and \(\text{P}_{\text{B}}\) matrixes are respectively cyclically shifted upward by \(\text{K}_{2}(\hat{\text{x}}_{22}^{\prime}(k))_{k=1}^{n}\) positions, where \(k=j\). Then, when \(\lambda_{\text{R,G,B}}(j)\leq 128\), the cyclic shifts are performed correspondingly downward to \(\text{K}_{2}(\hat{\text{x}}_{22}^{\prime}(k))_{k=1}^{n}\) positions. The upward and downward cyclic shift diagram is also displayed in Figure 4, and three scrambled matrices, \(\text{C}\text{1}_{\text{R}}\), \(\text{C}\text{1}_{\text{G}}\), and \(\text{C}\text{1}_{\text{B}}\), are obtained. Step 4: Execute bit-wise diffusion operation on each row of the matrixes \(\text{C}\text{1}_{\text{R}}\), \(\text{C}\text{1}_{\text{G}}\), and \(\text{C}\text{1}_{\text{B}}\) according to Equation (17). \[\left\{ \begin{array}{l}\text{C}\text{2}_{\text{R}}=(\text{C}\text{1}_{\text {R}}(i,j)+\text{K}_{2}(\hat{\text{x}}_{22}^{\prime}(k))_{k=1}^{n})\text{mod}256 \oplus\text{K}_{2}(\hat{\text{x}}_{22}^{\prime}(k))_{k=1}^{n}\\ \text{C}\text{2}_{\text{G}}=(\text{C}\text{1}_{\text{G}}(i,j)+\text{K}_{2}( \hat{\text{x}}_{22}^{\prime}(k))_{k=1}^{n})\text{mod}256\oplus\text{K}_{2}( \hat{\text{x}}_{22}^{\prime}(k))_{k=1}^{n}\\ \text{C}\text{2}_{\text{B}}=(\text{C}\text{1}_{\text{B}}(i,j)+\text{K}_{2}( \hat{\text{x}}_{22}^{\prime}(k))_{k=1}^{n})\text{mod}256\oplus\text{K}_{2}( \hat{\text{x}}_{22}^{\prime}(k))_{k=1}^{n}\\ \end{array} \right. \tag{17}\]  
Step 5: For the odd rows of the matrixes \(\text{C}\text{2}_{\text{R}}\), \(\text{C}\text{2}_{\text{G}}\), and \(\text{C}\text{2}_{\text{B}}\), they are cyclically shifted to the left by \(\text{K}_{3}[\hat{\text{s}}_{1}^{\prime}(k)]_{k=1}^{m}\) positions, and the even rows are rotated to the right by the same positions. Meanwhile, for the odd columns of the matrixes \(\text{C}\text{2}_{\text{R}}\), \(\text{C}\text{2}_{\text{G}}\), and \(\text{C}\text{2}_{\text{B}}\), they are respectively cycle shifted upward by \(\text{K}_{4}[\hat{\text{s}}_{2}^{\prime}(k)]_{k=1}^{n}\) positions, and the even columns are correspondingly shifted downward by the same positions. Then, three disordered matrices, \(\text{C}\text{3}_{\text{R}}\), \(\text{C}\text{3}_{\text{G}}\), and \(\text{C}\text{3}_{\text{B}}\), are produced. Step 6: Finally, a bit-level scrambling is implemented by the following formula:  
\[\left\{