LatinCrypt 2023: Privacy Preserving Edit Distance

This blog post summarizes the paper Privacy-Preserving Edit Distance Computation Using Secret-Sharing Two-Party Computation, which was presented at LatinCrypt by Hernán Vanegas (joint work with Daniel Cabarcas and Diego F. Aranha).

The edit distance is a metric for how related two strings of data are. It gives the number of insertions, deletions and substitutions needed to go from string A to string B. It is commonly used in genome sequencing and DNA analysis. This type of data is huge and highly sensitive, so finding an efficient way to compute this metric in a privacy preserving way is very important.
Previous research proposed solutions based on garbled circuits or homomorphic encryption [1,2], but in this paper, the authors turn to secret sharing.

The authors propose a 2PC algorithm for two parties to compute the edit distance between their own, private, sequences. The parties should learn no more than what information they could gain from the output of the computation. In the clear, the Wagner-Fischer (WF) algorithm provides a solution to the problem using dynamic programming. The core of that algorithm is to construct a matrix D containing all edit distances of the prefixes of the two strings. D is computed recursively, with following equation:

Recursive equation for D

The last element of this matrix is then the edit distance between the full-length strings.

To implement this algorithm in MPC, the main issue is how to find t(i,j).
Let’s split the WF in two parts: the preamble and the arithmetic part. In the preamble, we’ll compute t(i,j), and in the arithmetic part, we compute the matrix.

Preamble: finding t(i,j)

The first step should always be to find the alphabet of your problem. In the application of genomes, the alphabet consists of only 4 elements (DNA consists of A, C, G and T parts). This means that each character can be represented by just 2 bits. To check the equality of two 2-bit values, you first XOR the two values, after which you take the OR of this result. This results in a boolean representing (in)equation.
This step costs 4nm bits communication, equivalent to the cost of one multiplication.

The authors use DaBits to transform the binary shares into arithmetic shares, necessary for the next step.

Arithmetic part: computing D

The most efficient way to compute D, or rather, the final element of D, is to unroll the recursiveness of the formula given before. If we combine two levels into one step, we will get a new formula for D that contains ten unique elements, rather than just three:

Some of these equations are inherently redundant. For example, as t is always either 0 or 1, equation 3 is always larger than equation 2. Thus: the third equation can be dropped.
This can be repeated to recursion level l. Now, we’ve practically divided D into lxl subblocks. Within these blocks, we do not need to compute any values. Only the values at the bottom and right edge need to be computed, such that the next blocks can be computed based on this.
The larger the recursive level l, the larger these blocks, and the fewer blocks it takes to get to the final element of D. Compared to a straightforward implementation, this method reduces the number of rounds by a factor of l. But the larger this level, the more multiplications and comparisons we need, and the more expensive it will be. There is a trade-off here.

Optimal recursive level and number of equations

There is an upper bound on the number of equations, depending on l. With a graph, it is easier to see the dependencies between the entries of matrix D:

Black edges have label 1, red edges have another label. Each formula in the min{...} corresponds to a path in the graph. The authors proove that a formula can be called redundant and removed if
Black edges have label 1, red edges have another label. Each formula in the min{...} corresponds to a path in the graph. The authors prove that a formula P can be called redundant and removed if there is another path Q between the same points for which

r_{Q,P} + b_Q \leq b_P

where r_{Q,P} stands for the number of red edges in Q that are not in P,
b_Q stands for the number of black edges in Q and b_P the number of black edges in P.
Intuitively, this means that path P is longer than path Q.

Results

The authors give experimental results, indicating that for active security and pre-processing, which is the most useful model, there is indeed an optimal box size. The tests also indicate that this method with secret sharing is a lot more efficient than the methods with garbled circuits and homomorphic encryption.

Caught your interest? Go read the full paper on eprint!


[1] Tamara M. Dugan and Xukai Zou. “A Survey of Secure Multiparty Com-
putation Protocols for Privacy Preserving Genetic Tests”. In: CHASE.
IEEE, 2016, pp. 173–182
[2] Satsuya Ohata. “Recent Advances in Practical Secure Multi-Party Com-
putation”. In: IEICE Trans. Fundam. Electron. Commun. Comput. Sci.
103-A.10 (2020), pp. 1134–1141