攻防世界-——OldDriver
原理:rsa低加密指数广播攻击
拿到文件后,发现一份明文用不同的n,相同的e,进行了多次加密,产生了多份密文。并且e=10,不是很大,这是典型的低加密广播攻击。由c=E(m)=(m^e)modn 可以通过中国剩余定理,计算m^e。
x, y = 0, 1
lastx, lasty = 1, 0
while b:
a, (q, b) = b, divmod(a, b)
x, lastx = lastx - q * x, x
y, lasty = lasty - q * y, y
return (lastx, lasty, a)
def chinese_remainder_theorem(items):
N = 1
for a, n in items:
N *= n
result = 0
for a, n in items:
m