## 3 Principle and Theory of Coding  
To encode the binary information from the THz signature, obtained either in transmission or reflection, the PBG is divided into channels, each of them being labelled by a binary word. The transmitted peaks induced by the structural defect are then used to activate some of these channels (peak = channel activated, no peak = channel not activated). The corresponding binary code for the tag is then given by sorting and concatenating the binary codes of each activated channels. For example, in the case of Figure 3b, the PBG is divided in \(N\) = 8 channels, each of them corresponding to a 3-bits binary word. Channel 1 (at the lower frequency) and channel 8 (at the higher frequency) are associated to \(<\)000\(>\) and \(<\)111\(>\), respectively. In the present case, the structural defect leads to \(M\) = 2 peaks that activate the 3 rd and the 6 th channels, each of them corresponding to \(<\)010\(>\) and \(<\)101\(>\), respectively. Thereby, the corresponding binary word embedded into the spectral response can be coded over \(k\) = 6 bits: \(<\)010101\(>\). Even though the obtained binary code is composed of 6 digits, the effective number of possible binary words cannot be practically equal to 2\({}^{6}\) = 64, since some combinations are not allowed in this simple way of encoding. Indeed, the information is coded via the presence of peaks in given channels, without considering their magnitudes. Consequently, the system is not able to detect the presence of two superimposed peaks in the same channel. This means that, for example the code \(<\)010 010\(>\), as well as for all the other \"symmetric\" ones, are not allowed. Moreover, as the activated channels are arbitrarily read from the left-hand side to the right-hand side, it implies that if the word \(<\)010101\(>\) can be obtained, the word \(<\)101010\(>\) cannot. Taking into account these limitations, the number of different codes achievable with the above-described coding technique is given by the combinations \(C_{N}^{M}\) obtained by activating \(M\) channels among the \(N\) available, with \(M\) varying from 0 to \(=N\). In turn, the total coding capacity \(\rho\) (in bits) of the presented tags is:  
\[\rho(N)=log_{2}\left(\sum_{M=0}^{N}C_{N}^{M}\right)=N \tag{8}\]  
Thereby, the coding capacity (in bit) is equal to the number of channels \(N\) defined in the PBG, this latter depending directly on the PBG bandwidth \(\Delta f\), and the width of each channel \(\delta f\) (see Figure 3b):  
\[N=\left|\frac{\Delta f}{\delta f}\right| \tag{9}\]  
If \(\Delta f\) is fixed by the tag structure, \(\delta f\) can be limited by both the reader performance (spectral resolution) and the spectral bandwidth of the peaks. Indeed, to be distinguished, two peaks must be i. spectrally resolved and ii. separated by at least the full width at half maximum (FWHM) of the considered peaks whose value increases with the losses of the materials that constitute the layers in the tag. These two conditions constrain the channel width and in turn the coding capacity of the tag. Considering the frequency resolution of our reading system (about 7.6 GHz), which is limited by the maximum available time window to record the signal. Taking into account a value of \(\Delta f\) = 130 GHz and a \(\delta f\) \(\sim\) 16 GHz (two time the spectral resolution to be sure to really identify a peak), it leads to a coding capacity of 8 bits. It corresponds to a spatial coding density of about 40 bits/cm\({}^{2}\), as the THz beam diameter is about 5 mm. Nevertheless, to better evaluate the effect of these limiting parameters, we plot in Figure 4 the prospective evolution of the coding capacity \(\rho\) versus \(\delta f\), keeping constant the other characteristics of the tag presented previously similar to the width of the first PBG (\(\Delta f\) = 130 GHz). Thus, the channel number \(N\) varies inversely with \(\delta f\). Note that the coding capacity \(\rho\) can reach several tens of bits, when \(\delta f\) goes below 3 GHz typically.