*3.2. Simultaneous Vertical Confusion and Diffusion*

The simultaneous operation of vertical confusion and diffusion is similar to the process introduced in the subsection above.

• Step 1. Generate diffusion matrix *S*2.

Iterate the formula in Equation (4) *n*<sup>3</sup> + *M* × *N* times with initial value *x*3(1), *x*3(2) and control parameter *u*3. Then, the diffusion matrix *S*<sup>3</sup> is obtained according to:

$$S\_2(k,l) = \left\lfloor \mathbf{x}\_3(n\_3 + (k-1) \times M + l) \times 10^6 \right\rfloor mod256.\tag{11}$$

where *k* = 1, 2, .., *M* and *l* = 1, 2, ..., *N*.


Obtain *x*4(1), *x*4(2), *n*4, *u*<sup>4</sup> from the secret key and adjust them with the pixel value of image *I* according to Equation (12).

$$\begin{cases} \mathbf{x}\_4^l(1) = (\mathbf{x}\_4(1) + I(1, p\_l) / 255) mod 1, \\ \mathbf{x}\_4^l(2) = \mathbf{x}\_4(2), \\ \mathbf{n}\_4^l = \mathbf{n}\_4 + I(M\_\prime p\_l) \end{cases} \tag{12}$$

where:

$$p\_l = \begin{cases} N\_{\prime} & l=1\\ l=1, & \text{else.} \end{cases} \tag{13}$$

Then, using the initial value *x<sup>l</sup>* <sup>4</sup>(1), *<sup>x</sup><sup>l</sup>* <sup>4</sup>(2) and parameter *<sup>u</sup>*4, iterate Equation (4) *<sup>n</sup><sup>l</sup>* <sup>4</sup> + 2 times. Obtain *b<sup>l</sup>* <sup>2</sup> and *t l* <sup>2</sup> according to Equation (14).

$$\begin{cases} b\_2^l = \left\lfloor \mathbf{x}\_4^l (n\_4^l + 1) \times 10^6 \right\rfloor mod N\\ t\_2^l = \left\lfloor \mathbf{x}\_4^l (n\_4^l + 2) \times 10^6 \right\rfloor mod N. \end{cases} \tag{14}$$

• Step 4. Vertical diffusion.

The vertical diffusion process is as follows:

$$\begin{aligned} \text{for } k &= 1:M\\ if \; k &= 1\\ I(q\_k, l) &= I(q\_{k'}, l) \oplus S\_2(k, j) \\\\ \text{else} \\ I(q\_{k'}, l) &= I(q\_{k-1}, l) \oplus I(q\_{k'}, l) \oplus S\_2(k, l) \\\\ \text{end if} \\ \text{end for} \end{aligned}$$

where:

$$q\_k = \begin{cases} b\_{2'}^l & k=1\\ M\_{\prime} & (b\_2^l + k - 1) = M\\ (b\_2^l + k - 1) \bmod{M\_{\prime}} & \text{else.} \end{cases} \tag{15}$$

