The primes used for the modulus N
is of the form 2 ^ x - 1
. Such primes are called Mersenne’s primes, named after French mathematician Marin Mersenne.
A quick hack for factorisation is to lookup FactorDB, as I assume the primes are studied extensively. The result from FactorDB shows two primes $2^{2203}-1$ and $2^{2281}-1$
Another solution involves a bit of math. Suppose the two primes used are $2 ^ a - 1$ and $2 ^ b - 1$, and $a \leq b$. We thus have:
$$ n = (2 ^ a - 1)(2 ^ b - 1) = 2 ^ {a + b} - 2 ^ a - 2 ^ b + 1 = 2 ^ a (2 ^ b - 2 ^ {b - a} - 1) + 1 $$Thus, we have:
$$ n - 1 = 2 ^ a (2 ^ b - 2 ^ {b - a} - 1) $$We thus can divide $n - 1$ by 2 until the result is odd. We can divide $n - 1$ by that odd result to obtain $2 ^ a$. Recovering p,q
should be trivial after this.
Python Implementation:
|
|