Algorithm 1 Sybil Node Detection |
Initialization: K = ⌀, i = 0, = 1, = 1, = 1, = 1. |
|
procedure
|
2:
|
K ← K
|
4:
|
while
do
|
▹ is the number of nodes. |
6:
|
if K K
then
|
8:
|
K = K
|
10:
|
i = i + 1 |
12:
|
else
|
14:
|
K = K
|
16:
|
end if
|
18:
|
end while
|
20:
|
return K
|
22:
|
broadcast K to all nodes in the network. |
▹ After this broadcast, Node 0 will continue the following policy |
24:
|
(K, R) ←
|
26:
|
while R K do
|
28:
|
if R(SN) ≠ RSSI(R(SN)) then
|
30:
|
Exclude R(SN) |
32:
|
else
|
34:
|
RR← R(SN) |
36:
|
end if
|
38:
|
if R(GN) ≠ RSSI(R(GN)) then
|
40:
|
Exclude R(GN) |
42:
|
= + 1 |
44:
|
else
|
46:
|
RR← R(GN) |
48:
|
= + 1 |
50:
|
end if
|
52:
|
end while
|
54:
|
= 1 |
56:
|
bool = true |
58:
|
while bool do
|
60:
|
if SizeOf(RR(GN)) ≥ SizeOf(RR(GN) then
|
62:
|
R = RR(GN) |
64:
|
= + 1 |
66:
|
else
|
68:
|
R = RR(GN) |
70:
|
bool = false |
72:
|
end if
|
74:
|
end while
|
76:
|
return R
|
78:
|
broadcast R to all nodes in S. |
80:
|
end procedure
|