## Ps and Qs

#### RSA keys generated with one critical weakness

This command takes a public key from stdin and outputs modulus and exponent

openssl rsa -pubin -text -noout

To quickly search for common multiplicative factors, and later to find the modular multiplicative inverse of a number, use this algorithm

https://en.wikibooks.org/wiki/Algorithm*Implementation/Mathematics/Extended*Euclidean_algorithm

Don't put the leading '0x' on the answer

My path :

public key 1 : n1, e

public key 2 : n2, e

gcd(n1, n2) = p

q1 = n1 / p

φ(n1) = (p - 1) * (q1 - 1)

e.d1 ≡ 1 mod φ(n1) => e.d1 + k.φ(n1) = 1 egcd(e, φ(n1)) => d1

m1 = powmod(c1, d1, n1)

`/`

division is not the same operacion than `//`

! (it was my problem)

as j_junquera, with sage / is not the same as //