Exemplo n.º 1
0
def get_n(io):
    rsa_c, aes_c = encrypt_io(io, long_to_bytes(2))
    n = pow(2, 65537) - rsa_c
    for i in range(3, 6):
        rsa_c, aes_c = encrypt_io(io, long_to_bytes(i))
        n = primefac.gcd(n, pow(i, 65537) - rsa_c)
    return n
Exemplo n.º 2
0
def gcd(public_key1, public_key2):
    public1 = public_key1.public_numbers().e
    public2 = public_key2.public_numbers().e
    n1 = public_key1.public_numbers().n
    n2 = public_key2.public_numbers().n
    p = primefac.gcd(n1, n2)
    q1 = n1 / p
    q2 = n2 / p
    private1 = primefac.modinv(public1, (p - 1) * (q1 - 1))
    private2 = primefac.modinv(public2, (p - 1) * (q2 - 1))
    return (build_rsa_private(n1, public1, private1, p, q1),
            build_rsa_private(n2, public2, private2, p, q2))
Exemplo n.º 3
0
def get_smallest_evenly_dividible():
    curr = 2520
    for i in xrange(11, 21):
        curr *= i / gcd(curr, i)
    return curr
Exemplo n.º 4
0
def get_smallest_evenly_dividible():
    curr = 2520
    for i in xrange(11, 21):
        curr *= i / gcd(curr, i)
    return curr
Exemplo n.º 5
0
def gcd(a,b):
    return primefac.gcd(a,b)