easy rsa

whole 2024-08-17 00:02:34 358 0


import gmpy2
from Crypto.PublicKey import RSA
from Crypto.Util.number import long_to_bytes

f = open(r"public.pem", 'r').read()
pub = RSA.importKey(f)
n, e = pub.n, pub.e

print(n)
p = 296173636181072725338746212384476813557
q = n // p
phi = (p-1) * (q-1)
c = open(r"flag.enc", 'rb').read()

d = gmpy2.invert(e, phi)
m = pow(int.from_bytes(c), int(d), n)
print(long_to_bytes(m))

分类:Crypto
评论
yaozhiwang 6天前

代码能执行?是不是少了点东西

回复 0
image
作者:whole

3

提交

0

收入

相关WriteUP

问题反馈