Wouter Legiest and Jan-Pieter D'Anvers, COSIC, KU Leuven; Bojan Spasic and Nam-Luc Tran, Society for Worldwide Interbank Financial Telecommunication (Swift); Ingrid Verbauwhede, COSIC, KU Leuven
This paper presents a novel approach to calculating the Levenshtein (edit) distance within the framework of Fully Homomorphic Encryption (FHE), specifically targeting third-generation schemes like TFHE. Edit distance computations are essential in applications across finance and genomics, such as DNA sequence alignment. We introduce an optimised algorithm that significantly reduces the cost of edit distance calculations called Leuvenshtein. This algorithm specifically reduces the number of programmable bootstraps (PBS) needed per cell of the calculation, lowering it from approximately 94 operations—required by the conventional Wagner-Fisher algorithm—to just 1. Additionally, we propose an efficient method for performing equality checks on characters, reducing ASCII character comparisons to only 2 PBS operations. Finally, we explore the potential for further performance improvements by utilising preprocessing when one of the input strings is unencrypted. Our Leuvenshtein achieves up to 278x faster performance compared to the best available TFHE implementation and up to 39x faster than an optimised implementation of the Wagner-Fisher algorithm. Moreover, when offline preprocessing is possible due to the presence of one unencrypted input on the server side, an additional 3x speedup can be achieved.
Open Access Media
USENIX is committed to Open Access to the research presented at our events. Papers and proceedings are freely available to everyone once the event begins. Any video, audio, and/or slides that are posted after the event are also free and open to everyone. Support USENIX and our commitment to Open Access.
author = {Wouter Legiest and Jan-Pieter D{\textquoteright}Anvers and Bojan Spasic and Nam-Luc Tran and Ingrid Verbauwhede},
title = {Leuvenshtein: Efficient {FHE-based} Edit Distance Computation with Single Bootstrap per Cell},
booktitle = {34th USENIX Security Symposium (USENIX Security 25)},
year = {2025},
isbn = {978-1-939133-52-6},
address = {Seattle, WA},
pages = {8423--8440},
url = {https://www.usenix.org/conference/usenixsecurity25/presentation/legiest},
publisher = {USENIX Association},
month = aug
}


