Skip to main content
. 2023 Apr 7;23(8):3817. doi: 10.3390/s23083817
Algorithm 2 Clear the slot
Require: a hash table with N slots, hash_table; each slot contains three fields: ip, mac, counter; an array with k random numbers, rand; the length of a bucket, row_length;
1: procedure CLEAR-SLOT(src_ip, dst_mac)
2:  now_column, hash_value0
3:  insert_slotip: 0, mac: 0, counter: 0
4:  for i = 1 to k do
5:    hash_valuehash(src_ip, dst_mac, randi)
6:    now_indexnow_columnrow_length+hash_value
7:    now_columnnow_column+1
8:    read_slotread_hash_table(now_index)
9:    if read_slot.ip=src_ip and read_slot.mac=dst_mac then
10:       write_hash_table(now_index, insert_slot)
11:    end if
12:  end for
13: end procedure