/* -*-c-*-
*
- * $Id: rho.c,v 1.2 2000/10/08 12:11:22 mdw Exp $
+ * $Id: rho.c,v 1.5 2004/04/08 01:36:15 mdw Exp $
*
* Pollard's rho algorithm for discrete logs
*
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: rho.c,v $
- * Revision 1.2 2000/10/08 12:11:22 mdw
- * Use @MP_EQ@ instead of @MP_CMP@.
- *
- * Revision 1.1 2000/07/09 21:32:30 mdw
- * Pollard's rho algorithm for computing discrete logs.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include "fibrand.h"
MP_DROP(*(mp **)x);
}
-static rho_ops prime_ops = {
+static const rho_ops prime_ops = {
prime_sqr, prime_mul, prime_eq, prime_split, prime_drop
};
/* --- The main loop --- */
while ((l = rho(&cc, &x, &y, aa, bb)) == 0) {
- mpmont_factor f[2];
+ mp_expfactor f[2];
if (!r)
r = fibrand_create(0);
aa = mprand_range(MP_NEW, n, r, 0);
bb = mprand_range(MP_NEW, n, r, 0);
- f[0].base = g; f[0].exp = aa;
- f[1].base = a; f[1].exp = bb;
+ f[0].base = cc.g; f[0].exp = aa;
+ f[1].base = cc.a; f[1].exp = bb;
x = mpmont_mexpr(&mm, MP_NEW, f, 2);
y = MP_COPY(x);
}