# Malicious Cognitive User Identification Algorithm in Centralized Spectrum Sensing System
## 3 Malicious User Identification Algorithm  
We used the calculated prestige value to determine whether the cognitive user is a malicious cognitive user. Before discussing the malicious cognitive user identification algorithm based on multi-channel collaboration, we defined that the number of cognitive users in the system is \(j\); the data fusion center assigning data depth to each cognitive user is \(L\); and the initial reputation value of each cognitive user on each sub-channel is \(R_{jn}(1)=\frac{1}{2}\) (where \(j\) represents a cognitive user and \(n\) represents a sub-channel). Taking the \(l\)th spectrum sensing interval as an example, the algorithm is calculated as follows:  
The reputation value of the cognitive user \(j\) on the \(n\)th sub-channel is \(R_{jn}(l)\). According to Equation (3) we can calculate the weight of cognitive user \(j\) on the \(n\)th sub-channel:  
\[\omega_{jn}(l)=\frac{R_{jn}(l)}{\sum\limits_{j=1}^{l}R_{jn}(l)},j=1,\ldots,j;n =1,\ldots,N \tag{3}\]  
We combined this with the prestige value of the cognitive user on the sub-channel and the local perceived result of each cognitive user \(d^{(j)}(l)\in\{0,1\}^{N\times 1}\) at this perceptual interval. Using Equation (4), we calculate the estimated state of each sub-channel:  
\[\hat{d}_{n}(l)=\sum\limits_{j=1}^{J}\omega_{jn}(l)d_{n}^{(j)}(l) \tag{4}\]  
where \(d_{n}^{(j)}(l)\) is the perceived result of the cognitive user \(j\) to the state of the sub-channel \(n\). Comparing the estimated state \(\hat{d}_{n}(l)\) of the sub-channel \(n\) on the perceived gap \(l\) with the majority decision threshold \(d_{th}=\frac{1}{2}\) to obtain the actual state \(d_{n}(l)\) of the sub-channel \(n\) on the perceived gap \(l\), we obtain:  
\[d_{n}(l)=\left\{ \begin{array}{l}0,\hat{d}_{n}(l)<d_{th}\\ 1,\hat{d}_{n}(l)\geq d_{th}\end{array} \right. \tag{5}\]  
This \(d_{n}(l)\) is used as the element to get the perceived vector \(d(l)\in\{0,1\}^{N\times 1}\). Calculating the sum of the difference between the perceived results of the cognitive users on the sub-channels and the real state of the sub-channels, we obtain:  
\[\Delta d_{j}(l)=\sum\limits_{n=1}^{N}\left|d_{n}^{(j)}(l)-d_{n}(l)\right| \tag{6}\]  
Using the mean of the sum of the perceived deviation of the cognitive users on all sub-channels as the threshold of the perceived deviation, we obtain:  
\[\Delta\overline{d}(l)=\frac{1}{J}\sum\limits_{n=1}^{N}\sum\limits_{j=1}^{l} \Delta d_{n}^{(j)}(l) \tag{7}\]  
By comparing the perceived result's deviation of the cognitive user with the deviation threshold, it is possible to obtain a positive or negative evaluation \(r_{j}(l)\) of the cognitive user at this perceived gap as follows:  
\[r_{j}(l)=\left\{ \begin{array}{l}0,\Delta d_{j}(l)\geq\Delta\overline{d}(l) \\ 1,\Delta d_{j}(l)<\Delta\overline{d}(l)\end{array} \right. \tag{8}\]In this equation, \(r_{j}(l)=1\) indicates that the cognitive user \(j\) has made a positive contribution in the process of determining the channel state. On the contrary, \(r_{j}(l)=0\) indicates that the cognitive user \(j\) has made a negative effect in the process of determining the channel state. It has been assumed that the data fusion center's maximum storage length to the cognitive user evaluation history record \(r_{j}(l)\) is \(L\). Essentially, the data fusion center can only store the cognitive users' evaluations that are obtained from \(L\) perceived gaps. Using the historical evaluation of cognitive users to calculate the positive total evaluation \(P_{j}(l)\) and the negative total evaluation \(N_{j}(l)\) at the perceived gap \(l\), we obtain:  
\[P_{j}(l)=\left\{ \begin{array}{l}\sum\limits_{l^{\prime}=1}^{l}r_{j}(l^{ \prime})\lambda^{(l-l^{\prime})},l<L\\ \sum\limits_{l^{\prime}=l-L+1}^{l}r_{j}(l^{\prime})\lambda^{(l-l^{\prime})},l \geq L\\ \end{array} \right. \tag{9}\]  
\[N_{j}(l)=\left\{ \begin{array}{l}\sum\limits_{l^{\prime}=1}^{l}(1-r_{j}(l^{ \prime}))\lambda^{(l-l^{\prime})},l<L\\ \sum\limits_{l^{\prime}=l-L+1}^{l}(1-r_{j}(l^{\prime}))\lambda^{(l-l^{\prime} )},l\geq L\\ \end{array} \right.