Pollard's rho algorithm for logarithms