# Is there any relationship between Paillier Cryptosystem's random r and other factors

I want to try run an example of Paillier cryptosystem(Algorithm), So i just started with some basic examples, but cannot obtain correct result/decryption. I just change random factor r from 97 to 101 in Reliable Implementation of Paillier Cryptosystem, and return with wrong result. is there any relation between the random r and other Paillier factors i,e; g, λ, n etc The other example is:

Key Gen:

p = 5, q = 7 ,n =3 5 ,n² = 1225;
g = n+1 = 36;
λ = LCM(p-1,q-1) = 12;
μ = L(g^λ mod n²)^(-1) mod n
μ = L(36^12 mod 1225)^(-1) mod 35
μ = L(421)^(-1) mod 35
μ = 3    ; where L(421) = 12


Encryption:

Let m = 32; random r = 17;
c = ((g^m) * (r^n)) (mod n^2)
c = ((36^32) * (17^35)) mod 1225
c = 278


Decryption:

m = L(C^λ mod n^2) * μ (mod n);
m = L((278^12) mod 1225) *3;
m = 1191*3 mod 35;
m = 3;


But the original message is 32. what is wrong? I went through some other example, but unable to decrypt correctly.

You made a mistake in decryption.

You wrote:

m = 1191*3 mod 35


You lost L(...) here. Instead of 1191 it should be L(1191):

m = L(1191)*3 mod 35
L(1191) = 34
m = 34*3 mod 35
m = 102 mod 35
m = 32


Voilà. We got the original message.