Home
Writeups Misc About
Roll Your Own

Roll Your Own

No shot I would get this. This challenge is based on the Paillier cryptosystem, an additive homomorphic cryptosystem.

Paillier cryptosystem exploits the fact that certain discrete logarithms can be computed easily. Indeed, by binomial theorem:

(1+n)x=1+nx+(x2)n2+higher powers of n

which, under modulo n2, leads to:

(1+n)x=1+nxmodn2

This is the crux of the challenge. Given the prime q, to generate g,n such that gq=1modn, one can choose g=q+1 and n=q2. This leads to:

(1+q)q=1+q2=1modn2

and given the public key p, one can compute the discrete log quickly by (p1)/q.

Python Implementation:

This provides some new light on some group that we can easily compute the discrete log. I have a huge tunnel vision on Euler's theorem, and thought that we are forced to do this under some group of order q - which is not easy for DLP as q is not so smooth. One other solution that I think of is to pick n=2q, but obviously this does not work as it would take too much time for calculation of this number. Although, DLP becomes very easy as we can specify the generator g=2, and given the public key, we can just calculate the log base 2 of the public key for the private key.