Inputs:
Set of trustworthy anchor positions:
Untrustworthy node position:
Set of untrustworthy node to anchor RSSs:
Detection threshold and “PFA adjustment” parameter:
Steps:
 Obtain the node to anchor distances .
 Compute the test statistic , using (25)
if   then
  set  wormhole_flag true
else if  
  set  wormhole_flag true with probability
else
  set  wormhole_flag true
end if
return  wormhole_flag
Algorithm 4: Wormhole detection after localization. Nonparametric approach: DWARFTest.