Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I have two machines, $A$ and $B$. $A$ encrypts a message $m$ and outputs the ciphertext $m^e \pmod n$. $B$ outputs $c$ such that $c = m^e \pmod p$ and $c = m^e + 1 \pmod q$. How can I use $A$ and $B$ to find $p$ and $q$? I am allowed to choose $m$ and $n$.

share|cite|improve this question

HINT $\ $ Consider $\rm\ gcd(A(m)-B(m),\:pq)$

share|cite|improve this answer
Ok, so I get this: A(M)=m^e+kp and B(M)=m^e+1+jq, k and j are some integers. gcd(A(M)-B(M),pq)=gcd(kp-jq-1,pq). I am stuck here. – Steven Oct 8 '10 at 2:48
Consider the value of A(m)-B(m) both mod p and mod q. Since A(m) is (n,n) mod (p,q) and B(m) = (n,n+1) then A-B = ... – Bill Dubuque Oct 8 '10 at 3:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.