Discrete Log Reduction via Chosen Composite Modulus n=q² (Paillier's Trick)
- •
What it is
- •
If a protocol lets an attacker choose the modulus a discrete-log-based scheme operates over — subject only to a loose compatibility check like "" for a fixed public — picking and turns the discrete logarithm problem into trivial division. This is the exact algebraic trick behind the Paillier cryptosystem's decryption: by the binomial theorem, , since every term with contains a factor of and vanishes. Computing with these chosen parameters directly and losslessly encodes in , recoverable by simple integer division — no discrete-log algorithm needed at all.
- •
- •
When to apply
- •
A protocol asks you to supply your own group parameters (a modulus , a generator ) subject only to a simple checkable relation, rather than fixing them to a hard, well-vetted group in advance — a clean signal that the "hard" discrete log problem might be escapable by choosing a deliberately weak, structured group.
- •
- •
Math
- •
exactly, so .
- •
- •
Worked example
- •
Let , , , and . Then , so . In general this recovers ; recovering an unrestricted exponent requires an external bound or more information.
- •
- •
Python
- •
n = q**2 g = q + 1 # server computes h = pow(g, x, n) using these chosen parameters x = (h - 1) // q
- •
- •
Cards
- •
What choice of modulus and generator makes the discrete log trivial here, and why?
- •
n = q², g = q+1 — because (1+q)^x mod q² collapses to exactly 1 + xq by the binomial theorem, with every higher-order term vanishing mod q².
- •
- •
What real cryptosystem is this exact algebraic trick the core mechanism of?
- •
The Paillier cryptosystem — this is essentially its decryption step, re-purposed here as an attack against a protocol that lets the attacker choose the modulus.
- •
- •