Recently I read about homomorphic cryptosystem. They might solve a problem. To do this there need to be some modifications from standard version.
Using Paillier here but a solution for other also fine.
E.g. given two cipher text $c_1,c_2$ with generator $g$ and factors $r_i$:
$c_i = g^{m_i} r_i^n \mod n^2$
$n=p\cdot q$, with $p,q$ primes
Now if they get multiplied
$c_1 \cdot c_2 \equiv g^{m_1} r_1^n \cdot g^{m_2} r_2^n = g^{m_1+m_2} (r_1r_2)^n \equiv g^{m_1+m_2} r^n \mod n$
The factors $m_1, m_2$ get added. If they get $n$ or larger they start over again. In normal use case that is prohibit by selecting a larger $n$.
Now I'm looking for a way to get this overflow for a special kind of $m$. Image an election with 3 candidates and their votes counted in one exponent.
E.g. candidate 1 has 5 votes, 2 has 6 and 3rd 42 votes, exponent of $g$ could be ${005006042}$. In another region it's ${133700123}$. If ciphers multiplied those exponents get added and sum up all votes for each single candidate. This exponent form only allows up to $999$ total votes for each candidate (assuming the total exponent number is $<n$).
In my use case there will always be some exponent overflow, no matter how big $n$ is. But instead the whole exponent it should be one for each candidate.
E.g. $700.800.900$ and $400.100.200$ should add up to $100.900.100$ instead of $1100.901.100$.
Is there a way to have multiple overflows in exponent? Or an alternative way for multiple counters?
Elements also get subtracted, so there need to be an underflow as well.
As far as I understood each cipher can(should?) have its own $r$. For my use case it need to be associative in some way. It need to be the same cipher independent of order and direction. E.g. adding 5 votes to a cipher should result in same ciphertext as adding 5 times one vote to the same cipher. That should work if there is only one $r$ (for each candidate)(+$r^{-1}$ for subtraction). But a single $r$ works against security, or?
You know another way to achieve this? Some way to check if two different $c_1\not= c_2$ have the same exponent without encrypting it would also work.