# FODIT: A Filter-Based Module for Optimizing Data Storage in B5G IoT Environments
## 2 Background
### Filters
```
1:Input : x ;
2:Output : Cuckoo filters \(F_{i}\) ;
3:function CF(\(x\))
4:\(f_{x}=fringert(x)\) ;
5:\(h_{1}=hash(x)\);
6:\(h_{2}=h_{1}\oplus hash(f_{x})\);
7:if\(bin[h_{1}]\) has an empty entry then
8:\(bin[h_{1}]\gets f_{x}\)
9:return Done;
10:else
11:if\(bin[h_{2}]\) has an empty entry then
12:\(bin[h_{2}]\gets f_{x}\)
13:return Done;
14:endif
15:endif
16:\(i=\) randomly chosen \(h_{1}\) or \(h_{2}\);
17:for\(count=1\) to\(MaxNumAttempts\)do
18: randomly select an entry \(e\) from \(bin[i]\) ;
19: swap \(f_{x}\) and the fingerprint \(f_{e}\) stored in entry \(e\) ;
20:\(j\gets i\oplus hash(f_{e})\)
21:if\(bin[j]\) has an empty entry then
22:\(bin[j]\gets f_{e}\) ;
23:return Done ;
24:endif
25:endfor
26:return Failure ;
27:return\(F_{i}\) ;
28:endfunction
```  
**Algorithm 2** Search (x)  
```
1:Input : x, \(F_{i}\) ;
2:Output : \(found\) ;
3:function SF(\(x,F_{i}\))
4:\(f_{x}=fringert(x)\) ;
5:\(h_{1}=hash(x)\);
6:\(h_{2}=h_{1}\oplus hash(f_{x})\);
7:if\(bin[h_{1}]\) has a \(f_{x}\)then
8:return\(found\);
9:else
10:if\(bin[h_{2}]\) has a \(f_{x}\)then
11:return\(found\);
12:endif
13:endif
14:return\(Notfound\) ;
15:endfunction
```  
**Algorithm 3** Delete (x)  
```
1:Input : x, \(F_{i}\) ;
2:Output : \(Yes\), \(No\) ;
3:function DF(\(x,F_{i}\))
4:\(Search\gets SF(x)\) ;
5:if\(Search==found\)then
6: Remove \(f(x)\)
7:return Yes;
8:else
9:return\(No\);
10:endif
11:endfunction
```  
**Algorithm 4** Delete (x)  
```
1:Input : x, \(F_{i}\) ;
2:Output : \(Yes\), \(No\) ;
3:function DF(\(x,F_{i}\))
4:\(Search\gets SF(x)\) ;
5:if\(Search==found\)then
6: Remove \(f(x)\)
7:return Yes;
8:else
9:return\(No\);
10:endif
11:endfunction
```  
**Algorithm 5** Delete (x)  
```
1:Input : x, \(F_{i}\) ;
2:Output : \(Yes\), \(No\) ;
3:function DF(\(x,F_{i}\))
4:\(Search\gets SF(x)\) ;
5:if\(Search==found\)then
7: Remove \(f(x)\)
8:return Yes;
9:else
10:return\(No\);
11:endif
12:endfunction
```  
**Algorithm 6** Delete (x)  
```
1:Input : x, \(F_{i}\) ;
2:Output : \(Yes\), \(No\) ;
3:function DF(\(x,F_{i}\))
4:\(Search\gets SF(x)\) ;
5:if\(Search==found\)then
7: Remove \(f(x)\)
8:return Yes;
9:else
10:return\(No\);
11:endif
12:endfunction
```  
**Algorithm 7** Delete (x)  
```
1:Input : x, \(F_{i}\) ;
2:Output : \(Yes\), \(No\) ;
3:function DF(\(x,F_{i}\))
5:\(Search\gets SF(x)\) ;
6:if\(Search==found\)then
7: Remove \(f(x)\)
8:return Yes;
9:else
11:endif
12:endfunction
```  
**Algorithm 8** Delete (x)  
```
1:Input : x, \(F_{i}\) ;
2:Output : \(Yes\), \(No\) ;
4:function DF(\(x,F_{i}\))
5:\(Search\gets SF(x)\) ;
6:if\(Search==found\)then
8: Remove \(f(x)\)
9:return Yes;
10:else
11:endif
12:endfunction
```  
**Algorithm 9** Delete (x)  
```
1:Input : x, \(F_{i}\) ;
2:Output : \(Yes\), \(No\) ;
3:function DF(\(x,F_{i}\))
5:\(Search\gets SF(x)\) ;
6:if\(Search==found\)then
7: Remove \(f(x)\)
8:return Yes;
9:else
10:return\(No\);
11:endif
13:endif
14:endif
15:endif
16:endif
17:endif
18:endif
19:endif
20:endif
21:endfunction
```  
**Algorithm 10** Delete (x)  
```
**Algorithm 11** Delete (x)
```
**Algorithm 12** Delete (x)  
```
1:Input : x, \(F_{i}\) ;
3:function DF(\(x,F_{i}\))
5:\(Search\gets SF(x)\) ;
6:if\(Search==found\)then
8: Remove \(f(x)\)
9:return Yes;
10:else



+++ ==WARNING: Truncated because of repetitions==



++

## 3 Related Work

A range of filter-based modules has been proposed for optimizing data storage in IoT environments. [PERSON] et al. [31] introduce the accommodative Bloom filter (ABF), a variant of the scalable Bloom filter, which outperforms existing variants in terms of false positive rates and query complexity. [PERSON] et al. [32] focus on IoT data management methods and optimization algorithms, emphasizing the use of local sub-servers and publish/subscribe mechanisms. [PERSON] et al. [33] propose a secure cloud storage service for IoT environments, using a provable data possession model and Bloom filters. Finally, [PERSON] et al.