# A Privacy-Preserving Record Linkage Method Based on Secret Sharing and Blockchain
## 4 Methods
### Data Preparation and Generation Module
#### 4.2.3 Mask Generation and Data Distribution  
In distributed computing, nodes compute the difference between two Bloom filters using the XOR operation (\(d_{i}=a_{i}\oplus b_{i}\)), generating Boolean-shared differences. These are converted to arithmetic shares using masks (\(m_{i}\)) to support additive aggregation for Hamming distance, ensuring computational security and privacy of results.  
Masks are designed to match the structure of Bloom filters and are generated per quasi-identifier attribute. The dataset contains \(n\) attributes, each encoded as a Bloom filter of length \(m\), with a corresponding mask \(M_{j}\) (length \(m\)). Each mask \(M_{j}\) is decomposed into the following: Boolean shares: \(M_{j}[i]\) is split into \(t\) Boolean shares, satisfying the following: \(m_{j,i1}\oplus\cdots\oplus m_{j,i,t}=M_{j}[i]\). Arithmetic shares: \(M_{j}[i]\) is split into \(t\) arithmetic shares, satisfying  
\[s_{j,i,1}+\cdots+s_{j,i,t}\equiv M_{j}[i](\text{mod }p) \tag{2}\]  
where \(p\) is a large prime.  
To improve efficiency and reduce the number of masks, record pairs are grouped and \(k\) sets of masks are generated. Each set is assigned to a group of record pairs rather than generating unique masks for each pair. The value of \(k\) balances efficiency and security: a smaller \(k\) reduces computational and storage overhead but increases the risk of collusion inference; a larger \(k\) reduces the number of record pairs sharing masks, enhancing resistance to collusion but increasing costs. The value of \(k\) can be dynamically adjusted based on the total number of record pairs \(N\) and system resources.  
Mask Generation Process (Managed by Blockchain Smart Contracts):  
1. Record Pair Grouping: The total number of record pairs \(M\) (\(M=\lvert D_{A}\rvert\cdot\lvert D_{B}\rvert\)) is divided into \(k\) groups (\(k\ll M\), e.g., \(k\approx\sqrt{M}\) or a fixed value like \(k=10\)) using deterministic hashing, balancing security and efficiency.
2. Mask Generation: For each group \(g\) (\(g=1,2,\ldots,k\)) and attribute \(j\) (\(j=1,2,\ldots,n\)), a mask \(M_{g,j}\) of length \(m\) is generated using a Verifiable Random Function (VRF) with \(g\) and \(j\) as inputs, ensuring randomness and fairness.
3. Share Decomposition: Boolean shares: \(M_{g,j}[i]\) is decomposed into \(t\) shares. Generate \(t-1\) random Boolean shares \(m_{g,j,i,1},\ldots,m_{g,j,i,t-1}\), and compute: \(m_{g,j,i,t}=M_{g,j}[i]\oplus m_{g,j,i,1}\oplus\cdots\oplus m_{g,j,i,t-1}\). Arithmetic shares: \(M_{g,j}[i]\) is decomposed into \(t\) shares. Generate \(t-1\) random arithmetic shares \(s_{g,j,i,1},\ldots,s_{g,j,i,t-1}\), and compute: \(s_{g,j,i,t}=\left(M_{g,j}[i]-\sum_{l=1}^{t-1}s_{g,j,i,l}\right)\)(mod \(p\)). Constant 1 Shares: To support Boolean-to-arithmetic (B2A) conversion, generate \(t\) arithmetic shares \(\left[1\right]_{A_{1}},\ldots,\left[1\right]_{A_{t}}\), satisfying \(\sum_{l=1}^{t}\left[1\right]_{A_{l}}\equiv 1\)(mod \(p\)), by randomly generating \(t-1\) shares and computing \(\left[1\right]_{A_{t}}\).
4. Storage and Management: The generated Boolean shares \(m_{g,j,i,l}\), arithmetic shares \(s_{g,j,j,l}\), and constant 1 shares \(\left[1\right]_{A_{l}}\) are uploaded to IPFS, obtaining CIDs. These CIDs, along with the CIDs of secret shares uploaded during the data preparation phase, are recorded and managed by smart contracts (e.g., mask management or data distribution contracts) to ensure efficient and secure data distribution.