Algorithm: Replay_Attack_Protect (T_data, R_data, H, L)

Data: Transmitting data=T_data, Receiving data=R_data, Authorize bit=H, Unauthorized bit=L. Result: Replay_attack=R_attack

(1) Start

(2) Connection==Serial Communication(); /*Check serial communication between router and coordinator*/

(3) If connection==Fail

(4) Return Start; /*Step 1*/

(5) End

(6) If connection==True then

(7) T_data==Encrypt(data); /*AES 128 bit encryption*/

(8) If R_data==‘H’ OR ‘L’ then /*128 bit decryption*/

(9) If R_data==‘H’ OR ‘L’

(10) Initialization i, data;

(11) Fori=1 to 10 do

(12) Data=data+1;

(13) Delay==200 ms;

(14) If Data>7

(15) R_Attack==Yes;

(16) Update Web(R_attack); /*Update web page with Replay_attack data*/

(17) Send Email(Admin); /*Send email to Admin notifying Replay_attack*/

(18) Return Start; /*Step 1*/

(19) End

(20) End

(21) End