# In Paillier homomorphic encryption, do we need to take modulo after multiplication of 2 ciphertexts?

The multiplication of 2 ciphertexts generated using Paillier encryption will result in encryption of sum of corresponding plaintexts. I need to do a linear combination operation of N integers in Paillier encrypted domain. Then after multiplying every 2 ciphertexts, do I have to take mod with respect to n^2. OR Is it enough to take mod after multiplying all the N ciphertexts?

Will both give the same result or not?

Yes, both will give the same result. However, taking mod after each multiplication is far more efficient: if you do not take modulos during intermediate multiplications, the size of the strings you are multiplying keeps increasing, and so does the time it takes to multiply new strings, at a very fast rate (if you multiply $n$ ciphertexts over the integers before taking the mod, you'll blow up their size by about $n$). This would be a huge unnecessary waste of computation, so you'd better take the modulo after each multiplication.