Member-only story

Solving Quadratic Equations With Homomorphic Encryption

Prof Bill Buchanan OBE FRSE
4 min readAug 24, 2024

Homomorphic encryption provides us with a way to process encrypted data, and where we can create a key pair and use the public key to encrypt the data, and then — after homomorphic processing — the result can be decrypted with the associated private key:

In this article, we will use many of the key elements of using the OpenFHE library, such as for basic evaluation functions (Add, Subtract and Multiply), using math functions (such as a square root function), and in using the divide operation. Overall, for x divided by y, we will invert y (with 1/y), and then multiply this value by x. The square root function will be implemented using a Chebyshev approximation method.

With CKKS, we can perform mathematical operations with homomorphic encryption using floating-point values. In this case, we will solve ax²+bx+c and for >4ac. The solution is:

If we try, −2x−3, we get:

This gives x=3 and x=−1 as the solutions.

In this case, we will encrypt the values of a, b and c. Initially, we encrypted the input floating point values:

    Plaintext a_plaintext  =…

--

--

Prof Bill Buchanan OBE FRSE
Prof Bill Buchanan OBE FRSE

Written by Prof Bill Buchanan OBE FRSE

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.

No responses yet