I want to do a very simple thing: Given two vectors, I want to encrypt them and do some calculation, then decrypt the result and get the inner product between both vectors. I want to do this as fast as possible for the biggest vector dimension possible.

Can you recommend any reference which may help me understand things and how to do it?

Or maybe you can even point me to some library that can do this? I found HELIB, but I don´t know if that is the best solution for my purpose. Since I have only basic knowledge in cryptography, I´ld like use it as black box as much as possible without having to put too much effort in the math behind it.

  • 3
    $\begingroup$ I'm not sure, but this may be a programming-related question with crypto-background. This may better live at SO. I think this will be close-voted as off-topic as you aren't interested in the FHE itself. $\endgroup$
    – SEJPM
    Jul 2, 2015 at 21:47
  • 2
    $\begingroup$ If you ask about which libraries to use, this is off topic. If you ask which cryptosystem has a particular property, it would be on topic. Please edit your question to make sure it is on topic so that it will not be closed. $\endgroup$
    – otus
    Jul 3, 2015 at 5:23

2 Answers 2


You can use these schemes instead:

These schemes enable you to do addition, a single multiplication, and more additions. For inner product, that's all you need (encrypt each item separately, multiply pairs, and add all together).

Not everything needs FHE. In any case, somewhat HE would suffice since it's just a single multiplication.

  • $\begingroup$ can i find any implementation to this scheme? $\endgroup$
    – member555
    Jul 4, 2015 at 21:32
  • $\begingroup$ Not that I know. The second one may be easier to implement; I'm not sure - you need to check. $\endgroup$ Jul 4, 2015 at 21:39
  • $\begingroup$ what about matrix multiplication? $\endgroup$
    – member555
    Jul 6, 2015 at 12:58
  • 1
    $\begingroup$ Matrix multiplication is just a lot of single multiplications followed by addition. There is no multiplication following a multiplication, so all should be fine. Check the paper. $\endgroup$ Jul 6, 2015 at 20:12

I think you must know what homomorphic encryption system can support inner product as you want. I hope that Dario Catalano, Dario Fiore - Boosting Linearly-Homomorphic Encryption to Evaluate Degree-2 Functions on Encrypted Data can help you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.