## 6 Security Analysis and Results
### Detection Time and Accuracy  
We first note that the underlying assumption in the \"secondary infection\" analysis that we present below is that the method in Line 6 of the active thread in Algorithm 1, _i.e._, \(n.getRandomHomeNber()\), returns a non-duplicate node \(p\) chosen uniformly at random from among all nodes in \(n\)'s home zone. This assumption does not hold in our implementation, since we insist on cache exchanges occurring between nodes that are within communication range to conserve energy and the fact that a sensor node is not aware of all of the other nodes in its home zone. Therefore, in our implementation, \(p\) is not a node chosen uniformly at random from the entire home zone, but a node chosen uniformly at random from among \(n\)'s immediate neighbors, _i.e._, its communication radius. We present our analysis below, feigning that the required assumption above is fulfilled, but present empirical validation subsequently to justify our analysis. The results are presented in Figure 3.  
Secondary infection analysis: Here, we analyze the speed with which the secondary infection spreads throughout the home zone. Here, secondary infection is meant to denote the identity and location of a duplicate node in the duplicate cache. The analysis below is adapted from the work done by [PERSON] _et al._[35] on replicated databases. In this analysis, we assume that this infection initially exists at only one node in the home zone. Of course, if there were more infected nodes, this spread would be accomplished faster. Let \(p_{i}\) denote the probability that a node \(n\) that belongs to the home zone of group \(G\) does not know the identity of the duplicate node at time \(i\). Let \(s\) be the size of node \(n\)'s home zone. Since we assume that only one node in the home zone is infected at the beginning of time, \(p_{0}=1-1/s\). We are interested in expressing the quantity \(p_{i}\) as a function of time to understand how fast it decreases with time. To this end, let us begin by expressing \(p_{i+1}\) in terms of \(p_{i}\). Node \(n\) will not get the infection at time \(i+1\) if any of the following conditions hold:  
1. If \(n\) was not infected at time \(i\),
2. The peer sensor node \(p\) that \(n\) contacted at time \(i\) was not infected and
3. No peer nodes that were infected contacted \(n\) at time \(i\). Let us now compute each of these probabilities. The probability of \(n\) not being infected at time \(i\) is \(p_{i}\). The probability that \(p\) was not infected at time \(i\) is also given by \(p_{i}\). Finally, let us compute the probability that no peer nodes that were infected contacted \(n\) at time \(i\). At time instant \(i\), there are \((1-p_{i})s\) expected number of nodes that are infected. The probability of one of these nodes not choosing to contact \(n\) is \(1-1/s\), since we assume that \(n\) was chosen uniformly at random from among all of the \(s\) nodes in the home zone. Hence, the probability that no peer nodes that were infected contacted \(n\) at time \(i\) can be given by \((1-1/s)^{(1-p_{i})s}\). Putting all of this together, we see that:  
\[p_{i+1}=p_{i}p_{i}(1-1/s)^{(1-p_{i})s}\]It follows therefore that,  
\[p_{i+1}<p_{i}^{2}<p_{0}^{2^{i+1}}=(1-1/s)^{2^{i+1}}\]  
hence showing that \(p_{i}\) decreases super-exponentially fast. In Figure 3, we see the convergence of \(p_{i}\) for different sizes of the neighborhood caches exchanged among the nodes in the home zone corresponding to group \(G\) along with the theoretical expected exponential decline. With increasing cache sizes exchanged among the nodes (naturally increasing the communication cost), the discovery of duplicate nodes happens much faster, which leads to a faster dissemination of these duplicate node identities among the home zone nodes, as well. As we can see from the figure, in reality, the convergence is faster than what was suggested by our theoretical analysis.