IBM has rewritten its C++ homomorphic encryption library and claims it now goes up to 75 times faster.
Homomorphic encryption is a technique used to operate on encrypted data without decrypting it. This would make sensitive operations much more secure: for example, companies could encrypt their cloud-hosted databases, and work on them without converting records back to plaintext.
IBM has worked on homomorphic encryption for some time, and released the first version of its HElib C++ library three years ago, but as we reported in 2016, the technology has always suffered huge performance penalties.
IBM's first attempts at homomorphic encryption, under the hand of its inventor Craig Gentry, ran “100 trillion times” slower than plaintext operations. It later accelerated by a factor of two million times, running on a 16-core server.
Microsoft researchers smash homomorphic encryption speed barrierREAD MORE
Hence Big Blue's ongoing work on HElib. Released at GitHub, the latest version gets its performance kick from a “re-implementation of homomorphic linear transformations”, making it between 15 and 75 times faster.
In this paper at the International Association for Cryptologic Research, IBM's Shai Halevi and Victor Shoup (the latter also with New York University) explain how they improved speed.
“In the linear transformation algorithms currently implemented in HElib, the bulk of the time is spent moving data among the slots in the encrypted vector,” they wrote.
This is done with “special automorphisms” (a mathematical operation that maps an object to itself), and the computational cost comes from how many times the automorphisms have to loop around.
“The main cost of applying such an automorphism to a ciphertext is actually that of “key switching”: after applying the automorphism to each ring element in the ciphertext (which is actually a very cheap operation), we end up with an encryption relative to the “wrong” secret key; by using data in the public key specific to this particular automorphism — a so-called “key switching matrix” — we can convert the ciphertext back to one that is an encryption relative to the “right” secret key” the paper said.
“So the main goals in improving performance are to reduce the number of automorphisms, and to reduce the cost of each automorphism.”
In more accessible English, the new library implements a new strategy for calculating those automorphisms (achieving between 15 and 20 times speedup); the researchers refactored many of the necessary computations; and some of the calculations are shifted out of the library's main loop (getting a 6-8 times speedup).
The way public keys are constructed for homomorphic encryption is also expensive because of the aforementioned key-switching matrix. Each matrix adds several megabytes to the public key, and in HElib there could be several hundred such matrices in a public key. The researchers say for common operations, they were able to cut the size of the matrix by 33-50 per cent.
HElib is still a research-level project. As stated on the GitHub page: “At its present state, this library is mostly meant for researchers working on HE and its uses. Also currently it is fairly low-level, and is best thought of as 'assembly language for HE'. That is, it provides low-level routines (set, add, multiply, shift, etc.), with as much access to optimisations as we can give. Hopefully in time we will be able to provide higher-level routines.” ®