Homomorphic Encryption Arithmetic Operations I am looking to do arithmetic operations on encrypted values that will decrypt to be the result of the value decrypted. Does anyone know of any code examples of this in use? Usage of the equation would be nice as well.The psuedo from the below link is rather obscure. The specific reason behind asking the question is that I am having difficulty implementing this programmatically in a secure application I am working on. I understand math lingo somewhat but would like a working example involving real data.

Homomorphic Multiplication/Addition

So ideally given v1 and v2

v1 = 5; v2 = 4;

Decrypt(v1Encrypted + v2Encrypted) = 9;
The way to solve the problem in the question is to change the question slightly (beyond changing "Psuedo" to pseudo-code).

What really is wanted most likely  is


A public-private key pair generation method
An encryption function $E$; accepting as input any integer in $\mathbb Z_N$ (the plaintext), a public key generated as above, and a random number; producing as output an integer in $\mathbb Z_R$ (the ciphertext); so that knowledge of the ciphertext without the private key and the random number essentially won't reveal anything about the plaintext (with the possible exception of negligibly few plaintext). We'll note encryption $E$ functionally, omitting both it's public-key and random inputs: $E(5)$ will thus be different from one invocation to the other, including for a fixed public-private key pair.
A decryption function $D$, accepting as an element of $\mathbb Z_R$ and the private key, with the property that for $\forall x\in\mathbb Z_N, D(E(x))=x$ (when the public and private keys match).
An operation $\boxplus$ on $\mathbb Z_R$, such that
$$\forall x\in\mathbb Z_N,\forall y\in\mathbb Z_N,\ \ x+y&lt;N\implies D(E(x)\boxplus E(y))=x+y$$


Pallier encryption provides just that, with $R=N^2$ and $\boxplus$ defined as $u\boxplus v\ =\ u\cdot v\bmod R$.

Note: notation in this answer was adjusted to better match standard texts on Pailler encryption; refer to e.g. Jonathan Katz and Yehuda Lindell's Introduction to Modern Cryptography (2nd edition) section 13.2.