我需要迭代生成数字 x,它遵循这些条件
- (x^z) 模 n * x < n
- n 已知,z 在每个周期中变化
我需要它,因为我正在对 RSA 实施定时攻击,并且需要生成这样的数字来测量时间而不需要模块化减少
谢谢。
我需要迭代生成数字 x,它遵循这些条件
我需要它,因为我正在对 RSA 实施定时攻击,并且需要生成这样的数字来测量时间而不需要模块化减少
谢谢。
如果事先不知道 z 值的列表,您可能会为此尝试协程:
def compute_current(x, n, z):
# some computation here
def crunch(x, n):
current = x
z = yield current
while True:
current = compute_current(current, n, z)
z = yield current
c = crunch(x=10)
next(c)
new_x = crunch.send(some_z)
newer_x = crunch.send(some_other_z)
...