How to compute b modulo x using schoolbook version of the Pollard Rho method?

Viewed 38

I am currently self-studying cryptology to extend my expertise in this area. After reading the theory, I looked for related questions and came across the one described below. I thought I was able to answer is completely, but I am currently stuck with my computation and the question did not come with an answer.

The following information was provided:

I already came up with the following code fragment for the first steps, but I am not sure how to compute the final value for b modulo 47, as was asked for this specific example.

# Pollards-Rho 

# Define initial values
G = pow(g, (p - 1) // 47, p)
H = pow(h_B, (p - 1) // 47, p)
t = (pow(G, 17, p) * pow(H, 2, p)) % p
a = 17
b = 2

# Define update functions for t, a and b respectively
tf = {
    0: lambda : Mod(t * G, p),
    1: lambda : Mod(t * H, p),
    2: lambda : pow(t, 2, p)
}

af = {
    0: lambda : Mod(a + 1, p),
    1: lambda : a,
    2: lambda : Mod(2 * a, p)
}

bf = {
    0: lambda : b,
    1: lambda : Mod(b + 1, p),
    2: lambda : Mod(2 * b, p)
}

for i in range(10):
    t = int(t)
    print(f"{i}: t = {t}, a = {a}, b = {b}, t = {Mod(t, 3)} mod 3")
    t, a, b = tf[Mod(t, 3)](), af[Mod(t, 3)](), bf[Mod(t, 3)]() 

Any help would much appreciated!

0 Answers
Related