障眼法

腳本:
import sympy
import gmpy2
import libnum
n1 =
n2 =
c1=
c2=
e2=0xe18e
print(e2)
n22=n2//(13*25)
while 1:
a,s=gmpy2.iroot(n22,2)
#print(p1,s)
p=sympy.nextprime(a*13)
q=n2//p
if n2%p==0:
# print(p)
# print(q)
q=n2//p
break
# 當(dāng)e約去公約數(shù)后與phi互素
def decrypt(p, q, e, c):
n = p * q
phi = (p - 1) * (q - 1)
t = gmpy2.gcd(e, phi)
d = gmpy2.invert(e // t, phi)
print(d)
m = pow(c, d, n)
msg,s = gmpy2.iroot(m, t)
if msg:
return libnum.n2s(int(msg))
m=decrypt(p, q, e2, c2)
print(m)
phi=(p-1)*(q-1)
d1=libnum.invmod(n1,phi)
m1=pow(c1,d1,n2)
print(m1)
flag1=libnum.n2s(m1)
print(flag1)
print(flag1+m)
標(biāo)簽: