# FarpScun: Fully Anonymous Routing Protocol with Self-Healing Capability in Unstable Sensor Networks
## 3 Fully Anonymous Routing Protocol with Self-Healing Capability
### Fully Anonymous Routing Protocol with Self-Hailing Capability
#### 3.4.1 Establishment of On-Demand Anonymous Routes  
(1) Anonymous RREQ process. * The source node communicates with its neighbor candidate node When source \(S\) starts to look for a new route for destination node \(G\), it will work, as follows. Step 1: randomly select a new session ID \(SessID\) and a new key \(z_{S}\) from the \(SysLocal\) cryptosystem, and store it in the local storage in the form of \([SessID,z_{S}]\). Step 2: node \(S\) creates the one-hop anonymous identity \(HIA_{ID,S\leftrightarrow N}=H_{1}\left(Key_{S,N}\oplus ID_{S}\oplus ID_{N}\right)\) between node \(S\) and the next neighbor node \(N\). Figure 2: Route Establishment. Step 3: calculate \(Key_{S\leftrightarrow N}=H_{2}\left(Key_{S,N}\oplus ID_{S}\oplus ID_{N}\right)\) and encrypt \(pk_{G}\) with \(Key_{S\leftrightarrow N}\). Step 4: the created anonymous identity is used in order to compose the broadcast RREQ message with the following five attributes: \(E_{pk_{N}}(SessID)||HIA_{ID,S\leftrightarrow N}||E_{Key_{S\leftrightarrow N}} (pk_{G})||E(S,pk_{G})||E\left(z_{S},pk_{G}\right)\) Where the symbol \(||\) means the concatenation operation. Let \(\alpha\)=\(E(S,pk_{G})\),\(\mu\)=\(E\left(z_{S},pk_{G}\right)\), and source node \(S\) send the message to the next neighbor node. Step 5: update \(HIA_{ID,S\leftrightarrow N}\). * The intermediate node communicates with its neighbor candidate node When an intermediate node with address \(N\) receives a message in the form of \(E_{pk_{N}}(SessID)||HIA_{ID,S\leftrightarrow N}||E_{Key_{S\leftrightarrow N}} (pk_{G})||\alpha||\mu\), it will work as follows. Step 1: select a new key \(z_{N}\) randomly from the \(SysLocal\) cryptosystem, and store it in the local storage in the form of \([SessID,z_{N}]\); Step 2: node \(N\) creates an anonymous ID, the one-hop anonymous identity \(HIA_{ID,N\leftrightarrow N_{i}}\) between node \(N\) and the next neighbor node \(N_{i}\). Step 3: decrypt \(E_{Key_{S\leftrightarrow N}}(pk_{G})\) with \(Key_{S\leftrightarrow N}\) to retrieve \(pk_{G}\), and then use \(Key_{N\leftrightarrow N_{i}}\) to encrypt \(pk_{G}\). Step 4: construct the anonymous identity that communicates with the next neighbor node to form the new RREQ message: \(E_{pk_{N_{i}}}(SessID)||HIA_{ID,N\leftrightarrow N_{i}}||E_{Key_{N \leftrightarrow N_{i}}}(pk_{G})||Merge\left(E\left(N,pk_{G}\right),\alpha \right)\)\(||Merge\left(E\left(z_{N},pk_{G}\right),\mu\right)\). Let \(\alpha\)=\(Merge\left(E\left(N,pk_{G}\right),\alpha\right)\), \(\mu\)=\(Merge\left(E\left(z_{N},pk_{G}\right),\mu\right)\), and send the message to the next neighbor node. Step 5: update \(HIA_{ID,N\leftrightarrow N_{i}}\). * Destination node receives forwarding data When the destination node \(G\) receives the data \(\alpha\), it uses the theorem \(Sep\left(D\left(Merge\left(E\left(x_{1},pk\right),\ldots,E\left(x_{l},pk \right)\right),sk\right),i\right)=D\left(E\left(x_{i},pk\right),sk\right)\) of bounded decomposition in order to easily recover the whole route \(S.N_{1}.N_{2}\cdots\)\(N_{m}.G\). \[N_{m}:=Sep1\left(D\left(\alpha,sk_{G}\right)\right);\beta_{1}:=Sep2\left(D \left(\alpha,sk_{G}\right)\right);\] \[N_{m-1}:=Sep1\left(D\left(\beta_{1},sk_{G}\right)\right);\beta_{2}:=Sep2 \left(D\left(\beta_{1},sk_{G}\right)\right);\] \[\cdots\] \[N_{1}:=Sep1\left(D\left(\beta_{m-1},sk_{G}\right)\right);\beta_{m}:=Sep2 \left(D\left(\beta_{m-1},sk_{G}\right)\right);\] \[S:=Sep1\left(D\left(\beta_{m},sk_{G}\right)\right).\] Similarly, when the destination node \(G\) receives the data \(\mu\), it can recover the keys \(z_{S}.z_{N_{1}}.\cdots.z_{G}\) stored locally at each node of the route. These keys can be used for fast encryption and decryption of any message exchange between the destination node and the corresponding intermediate node (in the context of the current session) during the route reply process. In the process of route establishment, lightweight encryption can also be used.