• Step 4. Horizontal diffusion.

The horizontal diffusion operation is performed based on the XOR operation. The operation process is as follows:

$$\begin{aligned} for \ j &= 1:N\\ if \ j &= 1\\ I(i, c\_j) &= I(i, c\_j) \oplus S\_1(i, j)\\ \text{else} \\ I(i, c\_j) &= I(i, c\_{j-1}) \oplus I(i, c\_j) \oplus S\_1(i, j) \\ \text{end } if\\ \text{end for} \end{aligned}$$

where

$$c\_{j} = \begin{cases} b\_{1'}^{i} & j = 1 \\ N\_{\prime} & (b\_{1}^{i} + j - 1) = N \\ (b\_{1}^{i} + j - 1)modN\_{\prime} & \text{else} \end{cases} \tag{10}$$

