解密脚本:
p=473398607161
q=4511491
e=17def extended_euclidean(a, b):if b == 0:return a, 1, 0gcd, x1, y1 = extended_euclidean(b, a % b)x = y1y = x1 - (a // b) * y1return gcd, x, ydef calculate_private_key(p, q, e):phi = (p - 1) * (q - 1)gcd, x, y = extended_euclidean(e, phi)if gcd != 1:raise ValueError("e and phi(n) are not coprime")d = x % phiif d < 0:d += phireturn dd = calculate_private_key(p, q, e)
print(f"私钥 d 是: {d}")
运行得到flag{125631357777427553}