xor_factor icon indicating copy to clipboard operation
xor_factor copied to clipboard

Given p xor q and n=p*q for two unknown primes p and q, factor n and output p and q.

Let p and q be two (large, unknown) primes. Moreover, let us know n=pq and x=p XOR q.

Given numbers n and x, this code efficiently (but slightly slowly, because it's Python) factors n and outputs p and q.

Usage:

./ xor_factor.py n x

The algorithm is the one described in this Math StackExchange answer.