## 3 Proposed 2D DW-ZCC Code
#### Code Properties  
To determine the auto- and cross-correlation properties of the proposed codes, four different characteristic matrices are defined as D\(\mathbb{Z}^{d}\), where \(d\in\left(1,2,3,4\right)\). The four codes can be represented mathematically as follows: \begin{table}
\begin{tabular}{c c} \hline \hline
**X\({}^{th}\) Code Sequences** & **Y\({}^{th}\) Code Sequences** \\ \hline \(X_{1}=\left\{1100\right\}\) & \(Y_{1}=\left\{0011\right\}\) \\ \hline \(X_{2}=\left\{0011\right\}\) & \(Y_{2}=\left\{1100\right\}\) \\ \hline \end{tabular}
\end{table} 
Table 1: Spectral (X) and spatial (Y) code sequences extracted from 1D DW-ZCC code. \begin{table}
\begin{tabular}{c|c|c|c|} \hline \hline \multicolumn{1}{c}{\(\mathbf{Y}_{h}^{T}\)\(\mathbf{X}_{g}\)} & \(\mathbf{X_{1}=[1100]\)} & \(\mathbf{X_{2}=[0011]\)} \\ \hline \(\mathrm{Y}_{1}^{T}\) & \(\begin{bmatrix}1\\ 1\\ 0\\ 0\end{bmatrix}\) & \(\begin{bmatrix}1100\\ 1100\\ 0000\\ 0000\end{bmatrix}\) & \(\begin{bmatrix}0011\\ 0011\\ 0000\\ 0000\end{bmatrix}\) \\ \hline \(\mathrm{Y}_{2}^{T}\) & \(\begin{bmatrix}0\\ 0\\ 1\\ 1\end{bmatrix}\) & \(\begin{bmatrix}0000\\ 0000\\ 1100\\ 1100\end{bmatrix}\) & \(\begin{bmatrix}0000\\ 0000\\ 0011\\ 0011\end{bmatrix}\) \\ \hline \end{tabular}
\end{table} 
Table 2: Proposed 2D-spectral/spatial DW-ZCC code. \[ \begin{split}& DZ^{(1)}_{g,h}=Y^{T}_{h}X_{g}\\ & DZ^{(2)}_{g,h}=\overline{Y^{T}_{h}}X_{g}\\ & DZ^{(3)}_{g,h}=Y^{T}_{h}\overline{X_{g}}\\ & DZ^{(4)}_{g,h}=\overline{Y^{T}_{h}}\overline{X_{g}}\end{split}  \tag{1}\]  
where \(\overline{Y^{T}_{h}}\) and \(\overline{X_{g}}\) represent the complementary code sequences for \(X_{g}\) and \(Y^{T}_{h}\), respectively. Moreover, the 2D-spectral/spatial DW-ZCC code \(\text{DZ}_{g,h}\) is provided by a set of elements \(\text{d}z_{i,j}\), where \(i=\left(1,2,3,\ldots\ldots N_{1}\right)\) and \(j=\left(1,2,3,\ldots\ldots N_{2}\right)\). Hence, \(\lambda_{c}\) for the proposed 2D-spectral/spatial DW-ZCC code using \(\text{DZ}_{g,h}\) and \(\text{DZ}^{(d)}\) can be expressed as  
\[C^{(d)}(g,h)=\sum_{i=1}^{N_{2}}\sum_{j=1}^{N_{1}}dz^{(d)}_{(i,j)}dz_{(i,j)}(g,h) \tag{2}\]  
where \(\text{d}z^{(d)}_{(i,j)}\) is the (i,j)\({}^{th}\) entry of \(\text{DZ}^{(d)}\) and \(\text{d}z_{(i,j)}\)(g,h) is the (i,j)\({}^{th}\) entry of \(\text{DZ}_{(g,h)}\). Table 3 provides the auto- and cross-correlation properties for the 2D-spectral/spatial DW-ZCC code generated from Equation (2). Thus, the cross-correlation of \(\text{DZ}^{(d)}\) and \(\text{DZ}_{(g,h)}\) can be denoted as follows. \[C^{(d)}(g,h)=\sum_{i=1}^{N_{2}}\sum_{j=1}^{N_{1}}dz^{(d)}_{(i,j)}dz_{(i,j)}(g, h)= \begin{cases}w_{1}w_{2}&\text{for }g=h=1\\ 0&\text{for }\textit{otherwise}\end{cases}  \tag{3}\]  
The obtained auto- and cross-correlation properties can be utilized to determine the receiver architectures and type of detection technique employed to recover the intended signal. It can be observed that each sequence exhibits the maximum power units with itself and minimum or zero power units with adjacent and other codes. Therefore, a direct detection scheme can be employed at the receiving end to recover the intended signal. OCDMA codes exhibit high levels of security, as each sensor receives a unique code that can only be decoded through specific equipment at the respective receiver [43]. This inherent security feature is enhanced threefold in the proposed architecture by introducing second and third dimensions in the form of spatial and temporal encoding. Therefore, extension of the 1D DW-ZCC code to higher dimensions not only enhances performance, it elevates overall security of that particular network and makes it very difficult for an eavesdropper to recover the transmitted signal. Furthermore, code complexity is found to effect security of the OCDMA codes, as increased code complexity can increase the total amount of power required to transmit the encoded signal. This increases the overall signal-to-noise ratio (SNR) that is required for an eavesdropper to \"break\" the encoding by only a few dB [44].