## 3 Main Scheme
### Algorithm I. XOR-Based Visual Multi-Secret Scheme
If the selected secret image \(S_{A}\) is the last one (\(S_{A}=S_{N-1}\)), go to Step 5. We generate a group of pixels on share \(G_{2}\) based on another secret image \(S_{0}\) and the associated pixels on share \(G_{1}\). Further, we use the generated pixels on \(G_{2}\) to encrypt the associated pixels on \(G_{1}\) by \(S_{N-1}\). Repeat this step \(p\) times to finish. Finally, repeat the above Step 1-Step 5 until all the pixels in the shares \(G_{1}\) and \(G_{2}\) are generated. ```
Input: N secret images \(S_{0},\ S_{1},\ \ldots,\ S_{N-1}\) with size \(w\times h\) pixels, a positive integer \(p\) (must be a divisor of \(w\), and coprime to \(N-1\)). Output: Two shares \(G_{1}\) and \(G_{2}\) with size \(w\times h\). 1. \(A\) = random \((0,\ N-1)\)
2. \(S_{A}(i,j)\)\(\leftarrow\)\(f_{p}(S_{A})\)
3. Generate two pixels \(G_{1}(i,\ j)\) and \(G_{2}((i+A\times w/p)\ \%\ w,\ j)\) by Function \(f_{XRG}(S_{A}(i,j))\). If\(A\in\{0,\ 1,\ldots,N-2\}\), then go to Step 4. else\((A=N-1)\), go to Step 5. 4. For\(k=0\) to \(p-1\)do  Let \(A^{\prime}=(A+k+1)\ \%\ p\). \(G_{2}((i+A^{\prime}\times w/p)\ \%\ w,j)=f_{XORG}(S_{A+1}((i+k\times w/p)\ \%\ w,j))\), \(G_{1}((i+k\times w/p)\ \%\ w,j))\) \(G_{1}((i+(k+1)\times w/p)\ \%\ w,j))=f_{XORG}(S_{A}((i+(k+1)\times w/p)\ \%\ w,j))\), \(G_{2}((i+A^{\prime}\times w/p)\ \%\ w,j))\). 5. For\(k=0\) to \(p-1\)do  Let \(A^{\prime\prime}=1-N\). \(G_{2}((i+A^{\prime\prime}\times w/p)\ \%\ w,j)=f_{XORG}(S_{0}((i+k \times A^{\prime\prime}\times w/p)\ \%\ w,j))\), \(G_{1}((i+k\times A^{\prime\prime}\times w/p)\ \%\ w,j))\). \(G_{1}((i+(k+1)\times A^{\prime\prime}\times w/p)\ \%\ w,j))\) \(G_{1}((i+(k+1)\times A^{\prime\prime}\times w/p)\ \%\ w,j))\) \(G_{2}((i+k\times A^{\prime\prime}\times w/p)\ \%\ w,j))\)
6. Repeat Steps 1-5 until all pixels of two shares \(G_{1}\) and \(G_{2}\) are processed. ```  
**Algorithm 1**Input: N secret images \(S_{0},\ S_{1},\ \ldots,\ S_{N-1}\) with size \(w\times h\) pixels, a positive integer \(p\) (must be a divisor of \(w\), and coprime to \(N-1\)). Steps 4-5 including \(O(p)\) commands, which will be executed \(w\times h/p\) times. So the time complexity of Algorithm 1 is \(O(w\times h)\). Algorithm II. Augmented Shares Scheme  
Algorithm II extends the two shares generated by Algorithm I to \(n\) shares, so that \(n\) participants can share the secret image together. They will keep their own share, so the secret image cannot be recovered without any of them during recovery. In fact, Algorithm II directly encrypts \(G_{1}\) into \(\lfloor n/2\rfloor\) shares and \(G_{2}\) into \(\lfloor n/2\rfloor\) shares. After calculating the number of \(X\), \(Y\), we start to pick a pixel \((i,\ j)\) and assign values to all of the shares \(C_{0}\) - \(C_{n-1}\) in the same pixel position. As with coin tosses, the value is set to 0 or 1, with a 1/2 chance. Next, we calculate the sum of \(C_{0}(i,j)\) - \(C_{X-1}(i,j)\) as \(s\), and \(C_{X}(i,j)\) - \(C_{n-1}(i,j)\) as \(t\). In the process of giving values to the first part of the share, we first determine whether \(G_{1}(i,j)\) is white or not. If it is white (= 0), and the sum \(s\) is odd, we also randomly select \(C_{x}\) from these \(X\) shares; let \(C_{x}(i,j)=\overline{C_{x}\ (i,\ j)}\). If they add up to an even number, their values are not changed. If \(G_{1}(i,j)\) is black (= 1), and if the sum \(s\) is even, we randomly select \(C_{x}\) from these \(X\) shares; let \(C_{x}(i,j)=\overline{C_{x}\ (i,\ j)}\) again. If \(s\) is an odd number, their values are not changed. The second part of the share is calculated in the same way as the first part. We present Algorithm 2 for Algorithm II as shown below. The time complexity of Algorithm 2 is also O(_whm_).