Pollard's rho algorithm for computing discrete logs.