-3

i need to iteratively generate number x, which follow these conditions

  • (x^z) mod n * x < n
  • n is known, z changes in every cycle

i need it because I'm implementing timing attack on RSA, and it's needed to generate such number to measure time without modular reduction
Thanks.

wyDra
  • 65
  • 5

1 Answers1

0

If the list of z values is not known in advance you could probably try coroutine for this:

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)
...
hello world
  • 596
  • 2
  • 12