how can we use mathematica for POLLARD RHO ALGORITHM to compute the discrete logarithm problem in Zp^*
algorithem is
Let G be a cyclic group of order p, and given , and a partition , let be a map
and define maps and by
Inputs a a generator of G, b an element of G Output An integer x such that ax = b, or failureany help would be appreciated.
- Initialise a0 ← 0 b0 ← 0 x0 ← 1 ∈ G i ← 1
- xi ← f(xi-1), ai ← g(xi-1,ai-1), bi ← h(xi-1,bi-1)
- x2i ← f(f(x2i-2)), a2i ← g(f(x2i-2),g(x2i-2,a2i-2)), b2i ← h(f(x2i-2),h(x2i-2,b2i-2))
- If xi = x2i then
- r ← bi - b2i
- If r = 0 return failure
- x ← r -1 (a2i - ai) mod p
- return x
- If xi ≠ x2i then i ← i+1, and go to step 2
the problem i don't know how to use if anf else in mathematica for many conditions.