## 5 Module I: Anonymity
### Setup Phase
#### 5.2.1 Creating Pseudonyms  
The key idea is to use pseudonyms instead of using real IDs for the SNs and the BS during communication. Therefore, one disposable pseudonym per one transmission is used. This way, the ADV cannot trace back to the source using multiple messages containing the real ID. There are five kinds of transmissions that could happen in the WSN: (i) Multi- hop transmission between SN\({}_{i}\) and BS; (ii) transmission between two sensor neighbors i and j; (iii) broadcast sent by SN\({}_{i}\) or BS; (iv) acknowledgement; and (v) fake broadcast. The process starts by creating a pseudonym ID for each SN\({}_{i}\), we call it for short (PID\({}_{i}\)) which is computed using Equation (1): \begin{table}
\begin{tabular}{c c c} \hline
**Notation** & **Definition** & **Source** \\ \hline H1 & Hash function to create pseudonyms and the keys & Preloaded \\ H & Hash function to create data digest & Preloaded \\ k\({}_{i\to bs}\) & Pair-wise key shared between SN\({}_{i}\) \& BS & Preloaded \\ kb\({}_{i}\) & Broadcast key for SN\({}_{i}\) & Preloaded \\ fkb\({}_{i}\) & Fake broadcast key for SN\({}_{i}\) & Preloaded \\ N & Number of SNs in WSN & Learned \\ N\({}_{i}\) & Number of neighboring for SN\({}_{i}\) & Calculated \\ HC\({}_{i\to bs}\) & Hop-count between SN\({}_{i}\) \& BS & Learned \\ PID\({}_{i}\) & Pseudonym ID shared between SN\({}_{i}\) \& BS & Calculated \\ BPID\({}_{i}\) & Broadcast pseudonym ID & Calculated \\ a\({}_{i\to j}\) & Random value shared between SN\({}_{i}\) \& SN\({}_{j}\) & Calculated \\ k\({}_{i\to j}\) & Pair-wise key shared between SN\({}_{i}\) \& SN\({}_{j}\) & Calculated \\ OHPID \({}_{i\to j}\) & Pseudonym ID shared between SN\({}_{i}\) \& SN\({}_{j}\) & Calculated \\ APID\({}_{i}\) & ACK pseudonym ID for SN\({}_{i}\) & Calculated \\ FBPID\({}_{i}\) & Fake broadcast pseudonym ID & Calculated \\ T\({}_{i}\) & Table in SN\({}_{i}\) for shared parameters & Calculated \\ TIME\_STAMP & Time stamp & Calculated \\ SEQ\_NO & Sequence number for a message & Calculated \\ TTL & Time to live & Calculated \\ MCG\_LGTH & Message size & Calculated \\ \(\boldsymbol{\Delta_{residual}}\) & Residual energy & Calculated \\ \(\oplus\) & XOR Operation & Operation \\ \(\parallel\) & Concatenation operation & Operation \\ \hline \end{tabular}
\end{table} 
Table 2: _Cont._\[\text{PID}_{\text{i}}=\text{H}_{\text{i}}(\text{ID}_{\text{i}}\oplus\text{a}_{ \text{i}}) \tag{1}\]  
The SNi can calculate the broadcast pseudonym ID (BPIDi) according to Equation (2):  
\[\text{BPIDi}=\text{H}_{\text{i}}(\text{IDi}\oplus\text{b}_{\text{i}}) \tag{2}\]  
The SNi can calculate the fake broadcast pseudonym ID (FBPIDi) according to Equation (3):  
\[\text{FBPIDi}=\text{H}_{\text{i}}(\text{IDi}\oplus\text{c}_{\text{i}}) \tag{3}\]  
SNi should, by now, know its entire neighbor set (Ni). SNi will send a broadcast discovery message (Mdiscovery), to exchange parameters with all one-hop neighbors. The format of the message is stated in Equation (4):  
\[\text{Mdiscovery}=\text{K}_{\text{dis}}(\text{TTL}\parallel\text{ID}_{\text{i }}\parallel\text{k}_{\text{i}\leftrightarrow\text{bs}}\parallel\text{k}\text{ b}_{\text{i}}\parallel\text{fkb}_{\text{i}}\parallel\text{a}_{\text{i}} \parallel\text{b}_{\text{i}}\parallel\text{c}_{\text{i}}\parallel\text{ \Delta}_{\text{i}}\parallel\text{HC}_{\text{i}\leftrightarrow\text{bs}}) \tag{4}\]  
where TTL should be 1 for this transmission. Kdis is a shared common encryption key to secure the discovery message. SNi will receive also a similar broadcast message from SNj and from all other neighbors.