【Write Up】Do Math!

19011343447 2025-08-21 21:56:00 31 0 返回题目详情


byuctf{th3_g00d_m4th_1snt_th4t_h4rd}
from Crypto.Util.number import *

p = getPrime(2048)
q = getPrime(2048)
e = 0x10001
n = p * q
d = pow(e, -1, (p-1)*(q-1))

msg = "byuctf{th3_g00d_m4th_1snt_th4t_h4rd}"
m = bytes_to_long(msg.encode('utf-8'))

c = pow(m, e, n)

print(c)
print()

hints = [p, q, e, n, d]
for _ in range(len(hints)):
    hints[_] = (hints[_] * getPrime(1024)) % n
    if hints[_] == 0: hints[_] = (hints[_] - 1) % n

print("Hints:")
print(hints)
分类:Crypto
image
作者:19011343447

18

提交

0

收入

相关WriteUP

问题反馈