Let's consider such process:

  1. Two emitents emit two (integer) secret numbers independently
  2. They encrypt (encode) these number in such a way that no-one (except emitent) can decode these numbers. Emitents also cannot decode/know numbers of each other.
  3. Now having two block of decoded numbers we need to find the sum of these numbers

So, I need algorithms for achieving above

  1. Number decoding (point 2 above)
  2. Sum calculation (point 3 above)
  • $\begingroup$ I can think of a couple of different solutions, depending on what the requirements actually are. In (2), you ask for "Number decoding"; who does the decoding? Is it the parties that generated the numbers (and if they knew the numbers they generated, why do they need to decode them?) In (3), the numbers are "decoded"; those that mean if Alice picks the secret integer 2, that in step (3), it appears as the value 2? If so, what's so difficult about adding two integers? Thirdly, will the sum be published (so, after the protocol, everyone knows the integers everyone else picked)? $\endgroup$
    – poncho
    Mar 25, 2016 at 16:17
  • $\begingroup$ No one knows the integer except the one who emited it. I, as not emiter do not know those integers, but I have it in some decoded form. I need to find the sum of these integers. Which "decoded form" is actually the question $\endgroup$
    – Solvek
    Mar 25, 2016 at 16:29
  • 4
    $\begingroup$ By 'decoded form', do you mean 'encoded' (that is, transformed in such a way that it's not obvious what it is)? And, in step (3), who needs to find the sum of these integers; is it the two parties, or is it a third party? And, is the third party supposed to know the sum, or is it acceptable if he learns the individual integers as well?. It might be helpful if you sketch out an example of what needs to happen (e.g. in step 1, Alice and Bob select integers; in step 2, they encrypt their integers, and send them to each other, in step 3, ...) $\endgroup$
    – poncho
    Mar 25, 2016 at 16:32
  • 1
    $\begingroup$ Are you asking for Homomorphic Encryption? See : crypto.stackexchange.com/questions/30368/… $\endgroup$
    – JonSG
    Jul 1, 2016 at 17:27

1 Answer 1


Let $a$ and $b$ be the numbers emited rsp. by person A and person B. $E(x)$ means encoded form of $x$.

$E(a)$ and $E(b)$ are publicly known, right?

Note that if person A knows $a$, $E(a)$, $E(b)$ and person B knows $b$, $E(a)$, $E(b)$ and it is possible to calculate $a+b$ from $E(a)$ and $E(b)$ (that is what you want to do, right? So it must be possible) person A can calculate $a+b$ from the data he has. He also knows $a$ and calculating $b$ given $a+b$ and $a$ is trivial. Now person A knows the secret number of person B and person B can calculate the secret number of A same way.

I don't know what is this system going to be used for, but even if A and B trust each other there are still some security risks here.

  • $\begingroup$ I can see value here if there are an undefined number of people to emit one number and you want the final sum to be known. Or if A and B can emit a list of numbers each, and you want the final sum to be known, but not each individual value. $\endgroup$ Nov 12, 2022 at 16:22

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.