# Homomorphic Public/Private Key Encryption Scheme for Floating Numbers

Is there any public/private homomorphic encryption scheme that directly works on floating numbers or vectors of floating numbers?

In our application, we want to find out if $$v_1 \approx v_2, \qquad\text{or more precisely}\qquad \lVert v_1-v_2\mathbin\rVert < \epsilon,$$ with $$v_1$$ and $$v_2$$ being vectors with a fixed number of floating numbers.

An additional requirement for privacy protection is that we don't want the application to have access to the raw $$v_1$$.

So we suggest encrypting $$v_1$$, $$w_1 = \mathit{Enc}(v_1, k_{\mathit{pub}})$$ and sending the encrypted version $$w_1$$ and the public key.

In the application, we can then check if $$\mathit{Enc}(v_2, k_{\mathit{pub}})\approx w_1, \qquad\text{or more precisely}\qquad \lVert w_1-\mathit{Enc}(v_2, k_{\mathit{pub}})\rVert < \delta.$$

Is there an encryption scheme that supports this application?

Some references I found:

• There is mix on more precise part. Also, who is going to access the result? Commented Oct 8, 2019 at 12:32
• Bob is encrypting its $v_1$ and sending $w_1 = Enc(v_1, k_{pub})$ and $k_{pub}$ to Alice. Alice only wants to check if its $v_2$ is the same to $v_1$ or not. We want to make sure if Alice is compromised that the attacker doesn't have access to the raw $v_1$. Commented Oct 9, 2019 at 7:59
• So, Bob uses his public key then, Alice cannot learn the output since it encrypted. If Bob uses Alice's public key than Alice can learn the $v_1$ Commented Oct 9, 2019 at 8:02
• Yes but in this application we only want Alice to check if her key is the same as Bob's. Bob is only sending its encrypted key to Alice for Alice to check. We want to prevent Alice to learn about $v_1$, so that if she is compromised then the attacker does not have any access to $v_1$. Commented Oct 9, 2019 at 8:14
• You need something like the socialist millionaire problem. This might be helpfull Commented Oct 9, 2019 at 8:21