

# This file was *autogenerated* from the file solve.sage
from sage.all_cmdline import *   # import sage library

_sage_const_1 = Integer(1); _sage_const_10 = Integer(10); _sage_const_100 = Integer(100); _sage_const_1000 = Integer(1000); _sage_const_2 = Integer(2); _sage_const_128 = Integer(128); _sage_const_0 = Integer(0); _sage_const_29010 = Integer(29010)
from pwn import *

opt = [_sage_const_1 ,_sage_const_1 ,_sage_const_10 **_sage_const_100 ]
pls = Primes()[:_sage_const_1000 ]
while True:
    p = random_prime(_sage_const_2 **_sage_const_128 )
    if len(p.bits())==_sage_const_128  and is_prime(_sage_const_2 *p+_sage_const_1 ):
        break
q = _sage_const_2 *p+_sage_const_1 

Fp = GF(p)
Fq = GF(q)
print(p,q)

def map(P):
    return P[_sage_const_0 ]/P[_sage_const_1 ]

r = remote("01.cr.yp.toc.tf",_sage_const_29010 )

r.sendline(b"C")
r.sendline(str(p).encode())
r.sendline(b"A")
r.sendline(f"{p*q},{p*q}".encode())
r.sendline(b"S")
r.recvuntil(b"| P = (")
P = map([Fp(i) for i in r.recvuntil(b")")[:-_sage_const_1 ].split(b",")])
r.recvuntil(b"| k*P = (")
kP = map([Fp(i) for i in r.recvuntil(b")")[:-_sage_const_1 ].split(b",")])
r.recvuntil(b"| Q = (")
Q = map([Fq(i) for i in r.recvuntil(b")")[:-_sage_const_1 ].split(b",")])
r.recvuntil(b"| l*Q = (")
lQ = map([Fq(i) for i in r.recvuntil(b")")[:-_sage_const_1 ].split(b",")])
r.sendline(f"{kP/P},{lQ/Q}")
r.interactive()




# This file was *autogenerated* from the file solve.sage
from sage.all_cmdline import *   # import sage library

_sage_const_1 = Integer(1); _sage_const_10 = Integer(10); _sage_const_100 = Integer(100); _sage_const_1000 = Integer(1000); _sage_const_2 = Integer(2); _sage_const_128 = Integer(128); _sage_const_0 = Integer(0); _sage_const_29010 = Integer(29010)
from pwn import *

opt = [_sage_const_1 ,_sage_const_1 ,_sage_const_10 **_sage_const_100 ]
pls = Primes()[:_sage_const_1000 ]
while True:
    p = random_prime(_sage_const_2 **_sage_const_128 )
    if len(p.bits())==_sage_const_128  and is_prime(_sage_const_2 *p+_sage_const_1 ):
        break
q = _sage_const_2 *p+_sage_const_1 

Fp = GF(p)
Fq = GF(q)
print(p,q)

def map(P):
    return P[_sage_const_0 ]/P[_sage_const_1 ]

r = remote("01.cr.yp.toc.tf",_sage_const_29010 )

r.sendline(b"C")
r.sendline(str(p).encode())
r.sendline(b"A")
r.sendline(f"{p*q},{p*q}".encode())
r.sendline(b"S")
r.recvuntil(b"| P = (")
P = map([Fp(i) for i in r.recvuntil(b")")[:-_sage_const_1 ].split(b",")])
r.recvuntil(b"| k*P = (")
kP = map([Fp(i) for i in r.recvuntil(b")")[:-_sage_const_1 ].split(b",")])
r.recvuntil(b"| Q = (")
Q = map([Fq(i) for i in r.recvuntil(b")")[:-_sage_const_1 ].split(b",")])
r.recvuntil(b"| l*Q = (")
lQ = map([Fq(i) for i in r.recvuntil(b")")[:-_sage_const_1 ].split(b",")])
r.sendline(f"{kP/P},{lQ/Q}")
r.interactive()


# This file was *autogenerated* from the file solve.sage # import sage library