# A New One-Dimensional Compound Chaotic System and Its Application in High-Speed Image Encryption
## 3 The Proposed Image Encryption Scheme
### The Encryption Process
#### 3.1.3 Column-by-Column Encryption Processing
**Step 3:** Get the initial column vector \(\mathbf{S}=k\times[S(1)\), \(S(2)\),..., \(S(i)\),..., \(S(M)]\) according to Equation (17), where \(S(i)\) is the sum of all pixel values in the \(i\)-th row in the image \(\mathbf{P}\). **Step 4:** Sequentially execute the operations described by Equations (20) to (23) for \(j=1\), \(2\),..., \(N\), respectively, and complete the encryption of the \(j\)-th column:

Equation (20) obtains the \(\mathbf{S}\) vector at one time, which is equivalent to executing for all \(i=1\), \(2\),..., \(M\), respectively: \(S(i)=S(i)\)-\(P(i,j)\). \[\mathbf{h}=\text{bitvor}(\mathbf{X},\mathbf{c}). \tag{21}\]

An intermediate key sequence \(\mathbf{h}\) is obtained from Equation (21), where \(\mathbf{h}=[h(1)\), \(h(2)\),..., \(h(i)\),..., \(h(M)]\). Executing Equation (21) is equivalent to performing the following operations for all \(i=1\), \(2\),..., \(M\), respectively: \(h(i)=\text{bitvor}(X(i)\), \(c(i))\). \[\mathbf{C}(;J(j))=\text{bitvor}(\text{mod}(\mathbf{P}(;j)+\mathbf{S},256), \mathbf{h}). \tag{22}\]

Equation (22) completes the encryption processing of the \(j\)-th column \(\mathbf{P}(;j)\), and gets the pixel sequence \(\mathbf{C}(;J(j))\) of the \(J(j)\)-th column of the encrypted image. It can be seen that the \(j\)-th column of the image \(\mathbf{P}\) is arranged to the \(J(j)\)-th column of the encrypted image \(\mathbf{C}\), where the position transformation occurs; that is, the scrambling effect of the position is produced. In addition, the pixel value of the \(J(j)\)-th column of the encrypted image \(\mathbf{C}\) is different from the pixel value of the \(j\)-th column of the image \(\mathbf{P}\); that is, the substitution effect of pixel value is produced. Therefore, Equation (22) achieves both image column scrambling and pixel value substitution encryption. \[\mathbf{c}=\mathbf{C}(;J(j)). \tag{23}\]

Equation (23) updates the value of column vector \(\mathbf{c}\) to the currently encrypted image column \(\mathbf{C}(;J(j))\) in preparation for generating the intermediate key sequence \(\mathbf{h}\) of the next column. Thus, it can be seen that the intermediate key sequence \(\mathbf{h}\) used in the encryption of the \((j+1)\)-th column of image \(\mathbf{P}\) is related to the \(J(j)\)-th column of ciphertext. Similar to row-by-row encryption, there are two effects at the same time: One is to move the column (the pixels in column \(j\) of the image \(\mathbf{P}\) are moved to column \(J(j)\) of the encrypted image \(\mathbf{C}\)) to produce the column scrambling effect; in addition, the intermediate key \(\mathbf{h}\) is associated with the image content, which can make the algorithm have the ability to resist the chosen-plaintext attack. Figure 7b shows the process of column-by-column encryption. After completing the above three processing stages, the input image undergoes a complete encryption round. In order to improve the security, multiple rounds of encryption can be repeated; that is, a total encryption round number parameter \(T\) is set in advance according to the needs, and before the above algorithms 2, 3 and 4 are called, the number of rounds counting variable \(r\) is initialized to 1. Then call the above algorithms 1, 2 and 3. After a certain round of encryption is completed, update the variable value of rounds counting variable \(r\) (increase it by 1): \(r=r+1\). If \(r<=T\), take the currently obtained ciphertext matrix \(\mathbf{C}\) as a new round of input image \(\mathbf{P}\) to assign the current \(\mathbf{C}\) matrix to \(\mathbf{P}\): \(\mathbf{P}\)\(\leftarrow\)\(\mathbf{C}\). Then repeat the above algorithms 2, 3 and 4 until the number of encryption rounds reaches \(T\). The final output \(\mathbf{C}\) matrix is the final ciphertext image. The larger the number of encryption rounds \(T\), the more difficult it is to decipher the ciphertext and the higher the security, but the more time it takes to encrypt the image \(\mathbf{P}\). Therefore, the value of the \(T\) parameter should be determined according to actual demand.