# Research on Dynamic Searchable Encryption Method Based on Bloom Filter
## 5 Construction
```
1:\(W_{ind},para\)
2:\(ABF,EDB,B,NE\)
3:while\(W_{ind}\
eq null\)do
4:\(w_{ind}\leftarrow W_{ind}\setminus\{w_{ind}\}\)
5:\(Parse\ w_{ind}\) as \((w,st_{w},ind[j])\)
6:\(ABF\gets H^{\prime}=(h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w}))\)
7:\(c_{st_{w}}=1,\)\(B[st_{w}]=c_{st_{w}}\)
8:\(IE_{st_{w}}^{1}=H_{2}(w||1)\ \oplus(ind[1]||op)\)
9:\(add_{st_{w}}^{1}=H_{3}(st_{w})\)
10:\(rn_{1}\leftarrow\{0,1\}^{\lambda}\)
11:\(val_{st_{w}}=(IE_{st_{w}}^{1}||rn_{1})\ \oplus H_{3}(st_{w})\)
12:\(EDB[add_{st_{w}}^{1}]=val_{st_{w}}^{1}NE[st_{w}]=rn_{1}\)
13:for\(i=2\)do
14:\(IE_{st_{w}}^{i}=H_{2}(w||i)\ \oplus(ind[i]||op)\)
15:\(rn_{i}\leftarrow\{0,1\}^{\lambda},rn\leftarrow NE[st_{w}]\)
16:\(add_{st_{w}}^{i}=H_{3}(rn)\)
17:\(val_{st_{w}}^{i}=(IE_{st_{w}}^{i}||rn_{i})\ \oplus H_{3}(st_{w})\)
18:\(EDB[add_{st_{w}}^{i}]=val_{st_{w}}^{i}\)
19:\(NE[st_{w}]=rn_{i}c_{st_{w}}\gets B[st_{w}]\)
20:\(B[st_{w}]=c_{st_{w}}+1\)
21:endfor
22:endwhile
23:send \(ABF,EDB,B\) and \(NE\) to the cloud server
```  
**Algorithm 4** Trapdoor  
```
1:\(w,pp\)
2:\(st_{w}=H_{0}\Big{(}e\Big{(}g\Pi_{i-1}^{l}(x_{i}),p_{1}\Big{)}e(g^{w}p_{2},p_{0} )\Big{)}\)
3:\(Send\ st_{w}\) to Cloud Server
```  
**Algorithm 5** Search  
```
1:\(st_{w},para,EDB,B\)
2:\(res\leftarrow\emptyset\)
3:\(H^{\prime}=\big{(}h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w})\big{)}\)
4:if\(H^{\prime}\) can't be mapped to ABF, break;
5:else
6:\(c_{st_{w}}\gets B[st_{w}]\)
7:\(val_{st_{w}}\gets EDB[H_{3}(st_{w})]\)
8:\((IE_{st_{w}}^{1}||rn_{1})=val_{st_{w}}^{1}\oplus H_{3}(st_{w})\)
9:\(res=res\cup IE_{st_{w}}^{1}temp=rn_{1}\)
10:for\(y=2\)to\(c_{st_{w}}\)do
11:\(val_{st_{w}}^{i}\gets EDB[H_{3}(temp)]\)
12:\(\left(IE_{st_{w}}^{y}||rn_{y}\right)=val_{st_{w}}^{y}\oplus H_{3}(temp)\)
13:\(res=res\cup\left\{IE_{st_{w}}^{y}\right\},temp=rn_{y}\)
14:endfor
15:send res to DataUser
```  
**Algorithm 5** Search  
```
1:\(st_{w},para,EDB,B\)
2:\(res\leftarrow\emptyset\)
3:\(H^{\prime}=\big{(}h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w}) \big{)}\)
4:if\(H^{\prime}\) can't be mapped to ABF, break;
5:else
6:\(c_{st_{w}}\gets B[st_{w}]\)
7:\(val_{st_{w}}\gets EDB[H_{3}(st_{w})]\)
8:\((IE_{st_{w}}^{1}||rn_{1})=val_{st_{w}}^{1}\oplus H_{3}(st_{w})\)
9:\(res=res\cup IE_{st_{w}}^{1}temp=rn_{1}\)
10:for\(y=2\)to\(c_{st_{w}}\)do
11:\(val_{st_{w}}^{i}\gets EDB[H_{3}(temp)]\)
12:\(res=res\cup\left\{IE_{st_{w}}^{y}\right\},temp=rn_{y}\)
13:endfor
14:send res to DataUser
```  
**Algorithm 6** Search  
```
1:\(res\leftarrow\emptyset\)
2:\(H^{\prime}=\big{(}h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w}) \big{)}\)
3:if\(H^{\prime}\) can't be mapped to ABF, break;
4:else
5:\(c_{st_{w}}\gets B[st_{w}]\)
6:\(val_{st_{w}}\gets EDB[H_{3}(st_{w})]\)
7:\((IE_{st_{w}}^{1}||rn_{1})=val_{st_{w}}^{1}\oplus H_{3}(st_{w})\)
8:\(res=res\cup IE_{st_{w}}^{1}temp=rn_{1}\)
9:for\(y=2\)to\(c_{st_{w}}\)do
10:\(val_{st_{w}}^{i}\gets EDB[H_{3}(temp)]\)
11:\((IE_{st_{w}}^{y}||rn_{y})=val_{st_{w}}^{y}\oplus H_{3}(temp)\)
12:\(res=res\cup\left\{IE_{st_{w}}^{y}\right\},temp=rn_{y}\)
13:endfor
14:send res to DataUser
```  
**Algorithm 7** Search  
```
1:\(res\leftarrow\emptyset\)
2:\(H^{\prime}=\big{(}h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w}) \big{)}\)
3:if\(H^{\prime}\) can't be mapped to ABF, break;
3:else
4:\(c_{st_{w}}\gets B[st_{w}]\)
5:\(val_{st_{w}}\gets EDB[H_{3}(st_{w})]\)
6:\((IE_{st_{w}}^{1}||rn_{1})=val_{st_{w}}^{1}\oplus H_{3}(st_{w})\)
7:\(res=res\cup IE_{st_{w}}^{1}temp=rn_{1}\)
8:\(res=res\cup IE_{st_{w}}^{1}temp=rn_{1}\)
9:for\(y=2\)to\(c_{st_{w}}\)do
10:\(val_{st_{w}}^{i}\gets EDB[H_{3}(temp)]\)
11:\((IE_{st_{w}}^{y}||rn_{y})=val_{st_{w}}^{y}\oplus H_{3}(temp)\)
12:\(res=res\cup\left\{IE_{st_{w}}^{y}\right\},temp=rn_{1}\)
13:endfor
14:send res to DataUser
```  
**Algorithm 8** Search  
```
1:\(res\leftarrow\emptyset\)
2:\(H^{\prime}=\big{(}h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w}) \big{)}\)
3:if\(H^{\prime}\) can't be mapped to ABF, break;
4:else
5:\(c_{st_{w}}\gets B[st_{w}]\)
6:\(val_{st_{w}}\gets EDB[H_{3}(st_{w})]\)
7:\((IE_{st_{w}}^{1}||rn_{1})=val_{st_{w}}^{1}\oplus H_{3}(st_{w})\)
8:\(res=res\cup IE_{st_{w}}^{1}temp=rn_{1}\)
9:for\(y=2\)to\(c_{st_{w}}\)do
10:\(val_{st_{w}}^{i}\gets EDB[H_{3}(temp)]\)
11:\((IE_{st_{w}}^{y}||rn_{y})=val_{st_{w}}^{y}\oplus H_{3}(temp)\)
12:\(res=res\cup\left\{IE_{st_{w}}^{y}\right\},temp=rn_{1}\)
13:endfor
14:send res to DataUser
```  
**Algorithm 8** Search  
```
1:\(res\leftarrow\emptyset\)
2:\(H^{\prime}=\big{(}h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w}) \big{)}\)
4:\(H^{\prime}=\big{(}h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w}) \big{)}\)
5:\(H^{\prime}=\big{(}h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w}) \big{)}\)
6:\(H^{\prime}=\big{(}h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w}) \big{)}\)
7:\(H^{\prime}=\big{(}h_{1}(st_{w}),h_{2}(st_{w}),h_{3}(st_{w}),h_{4}(st_{w}) \big{)}\)
8:\(H^{\prime}=\big{
```
1:\(Doc,para,EDB,B\)
2:\(\textit{doc}\in\textit{Dec,Doc}\leftarrow\textit{Doc}\setminus\{doc\},flag=0\)
3:\(\textit{Prase}\textit{doc}\) as \((w,ind,st_{w},op^{\prime})\)
4:\(\textit{While}\textit{flag}==0\)do
5:if\(st_{w}\) not exit
6: update ABF
7:\(c_{st_{w}}=1,\textit{B}[st_{w}]=c_{st_{w}}\)
8:\(\textit{add}^{1}_{st_{w}}=H_{3}(st_{w})\), \(rn_{1}\in\{0,1\}^{\lambda}\)
9:\(IE^{1}_{st_{w}}=H_{2}(w||1)\oplus(ind[1]||op^{\prime})\)
10:\(\textit{val}^{1}_{st_{w}}=\{IE^{1}_{st_{w}}||rn_{1}\}\oplus H_{3}(st_{w})\)
11:\(flag=1\),update\(\textit{EDB},\textit{NE}\)
12:Put search token \(st_{w}\) in the ABF
13:else
14:\(c\gets B[st_{w}]\),\(rn\gets NE[st_{w}]\)
15:\(\textit{val}^{1}_{st_{w}}\gets EDB[H_{3}(st_{w})]\)
16:\((IE^{1}_{st_{w}}||rn_{1})=\textit{val}^{1}_{st_{w}}\oplus H_{3}(st_{w})\)
17:\((ind[1]||op)=IE^{1}_{st_{w}}\oplus H_{2}(w||1)\)
18:\(\textit{temp}=rn_{1}\)
19:if\(ind==ind[1]\)
20:\(op=op^{\prime},flag=1\)
21:else
22:for\(y=2\)to\(c\)do
23:\(\textit{val}^{y}_{st_{w}}\gets EDB[H_{3}(\textit{temp})]\)
24:\(\left(IE^{y}_{st_{w}}||rn_{y}\right)=\textit{val}^{y}_{st_{w}}\oplus H_{3}( \textit{temp})\)
25:\((ind[y]||op)=IE^{y}_{st_{w}}\oplus H_{2}(w||y)\)
26:if\(ind==ind[y]\)
27:\(op=op^{\prime},flag=1\)
28:endfor
29:\(rn_{c+1}\in\{0,1\}^{\lambda}\), \(NE[st_{w}]=rn_{c+1}\)
30:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
31:\(IE^{c+1}_{st_{w}}=\left(ind[c+1]||op\right)\oplus H_{2}(w||c+1)\)
32:\(\textit{val}^{c+1}_{st_{w}}=\left(IE^{c+1}_{st_{w}}||rn_{c+1}\right)\oplus H_{3} (rn)\),\(flag=1\)
33:endwhile
34:endwhile
```
**Algorithm 6** Update
```
1:\(W,para\)
2:\(CDB,ABF\)
3:\(r\in\{0,1\}^{\lambda}\)
4:for each keyword \(w_{i}\in\textit{Wdo}\)
5:\(t_{w}=e(g,g)^{w_{i}r}\)
6:\(st_{w}=H_{0}(t_{w})\)
7:\(add^{c+1}_{st_{w}}=H_{3}(st_{w})\)
8:\(\textit{val}^{1}_{st_{w}}=\left(IE^{1}_{st_{w}}||rn_{1}\right)\oplus H_{3}(st _{w})\)
9:\(Update\)\(EDB\)\(ABF\)
10:endfor
11:\(Send\)\(EDB\)\(ABF\) to Cloud Server
```
**Algorithm 7** UpdateST
```
1:\(r\in\{0,1\}^{\lambda}\)
2:for each keyword \(w_{i}\in\textit{Wdo}\)
3:\(t_{w}=e(g,g)^{w_{i}r}\)
4:\(st_{w}=H_{0}(t_{w})\)
5:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
6:\(\textit{val}^{1}_{st_{w}}=\left(IE^{1}_{st_{w}}||rn_{1}\right)\oplus H_{3}(st _{w})\)
7:\(Update\)\(EDB\)\(ABF\)
8:endfor
9:\(Send\)\(EDB\)\(ABF\) to Cloud Server
```
**Algorithm 8** Update
```
1:\(r\in\{0,1\}^{\lambda}\)
2:for each keyword \(w_{i}\in\textit{Wdo}\)
3:\(t_{w}=e(g,g)^{w_{i}r}\)
4:\(st_{w}=H_{0}(t_{w})\)
5:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
6:\(\textit{val}^{1}_{st_{w}}=\left(IE^{1}_{st_{w}}||rn_{1}\right)\oplus H_{3}(st _{w})\)
7:\(Update\)\(EDB\)\(ABF\)
8:endfor
9:\(Send\)\(EDB\)\(ABF\) to Cloud Server
```
**Algorithm 9** Update
```
1:\(r\in\{0,1\}^{\lambda}\)
2:for each keyword \(w_{i}\in\textit{Wdo}\)
3:\(t_{w}=e(g,g)^{w_{i}r}\)
4:\(st_{w}=H_{0}(t_{w})\)
5:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
6:\(\textit{val}^{1}_{st_{w}}=\left(IE^{1}_{st_{w}}||rn_{1}\right)\oplus H_{3}(st _{w})\)
7:\(Update\)\(EDB\)\(ABF\)
8:endfor
9:\(Send\)\(EDB\)\(ABF\) to Cloud Server
```
**Algorithm 10** Update
```
1:\(r\in\{0,1\}^{\lambda}\)
2:for each keyword \(w_{i}\in\textit{Wdo}\)
3:\(t_{w}=e(g,g)^{w_{i}r}\)
4:\(st_{w}=H_{0}(t_{w})\)
5:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
6:\(\textit{val}^{1}_{st_{w}}=\left(IE^{1}_{st_{w}}||rn_{1}\right)\oplus H_{3}(st _{w})\)
7:\(Update\)\(EDB\)\(ABF\)
8:endfor
9:\(Send\)\(EDB\)\(ABF\) to Cloud Server
```
**Algorithm 11** Update
```
1:\(r\in\{0,1\}^{\lambda}\)
3:for each keyword \(w_{i}\in\textit{Wdo}\)
4:\(t_{w}=e(g,g)^{w_{i}r}\)
5:\(st_{w}=H_{0}(t_{w})\)
6:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
7:\(\textit{val}^{1}_{st_{w}}=\left(IE^{1}_{st_{w}}||rn_{1}\right)\oplus H_{3}(st _{w})\)
8:\(Update\)\(EDB\)\(ABF\)
9:endfor
10:\(Send\)\(EDB\)\(ABF\) to Cloud Server
```
**Algorithm 12** Update
```
1:\(r\in\{0,1\}^{\lambda}\)
4:for each keyword \(w_{i}\in\textit{Wdo}\)
5:\(t_{w}=e(g,g)^{w_{i}r}\)
6:\(st_{w}=H_{0}(t_{w})\)
7:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
8:\(\textit{val}^{1}_{st_{w}}=\left(IE^{1}_{st_{w}}||rn_{1}\right)\oplus H_{3}(st _{w})\)
9:\(Update\)\(EDB\)\(ABF\)
10:endfor
11:\(Send\)\(EDB\)\(ABF\) to Cloud Server
```
**Algorithm 13** Update
```
1:\(r\in\{0,1\}^{\lambda}\)
4:for each keyword \(w_{i}\in\textit{Wdo}\)
5:\(t_{w}=e(g,g)^{w_{i}r}\)
6:\(st_{w}=H_{0}(t_{w})\)
7:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
8:\(\textit{val}^{1}_{st_{w}}=\left(IE^{1}_{st_{w}}||rn_{1}\right)\oplus H_{3}(st _{w})\)
9:\(Update\)\(EDB\)\(ABF\)
11:endfor
12:\(r\in\{0,1\}^{\lambda}\)
13:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
14:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
15:\(\textit{val}^{1}_{st_{w}}=\left(IE^{1}_{st_{w}}||rn_{1}\right)\oplus H_{3}(rn)\)
16:\(Update\)\(EDB\)\(ABF\)
17:endfor
18:\(r\in\{0,1\}^{\lambda}\)
19:\(r\in\{0,1\}^{\lambda}\)
20:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
21:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
22:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
23:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
24:\(add^{c+1}_{st_{w}}=H_{3}(rn)\)
25:\(\textit{val}^{1}_{st_{w}}=\left(IE^{1}_{st_{w}}||rn_{1}\right)\oplus H_\(Setup(\lambda)\to para\): The algorithm is run by the DO and the initialization parameters are defined.