projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New SHA variants with longer outputs.
[u/mdw/catacomb]
/
rho.c
diff --git
a/rho.c
b/rho.c
index
d4530b8
..
2ff20a6
100644
(file)
--- a/
rho.c
+++ b/
rho.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: rho.c,v 1.
1 2000/07/09 21:32:30
mdw Exp $
+ * $Id: rho.c,v 1.
2 2000/10/08 12:11:22
mdw Exp $
*
* Pollard's rho algorithm for discrete logs
*
*
* Pollard's rho algorithm for discrete logs
*
@@
-30,6
+30,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: rho.c,v $
/*----- 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.
*
* Revision 1.1 2000/07/09 21:32:30 mdw
* Pollard's rho algorithm for computing discrete logs.
*
@@
-135,7
+138,7
@@
mp *rho(rho_ctx *cc, void *x, void *y, mp *a, mp *b)
bb = mp_sub(bb, bb, b);
g = MP_NEW;
mp_gcd(&g, &bb, 0, bb, cc->n);
bb = mp_sub(bb, bb, b);
g = MP_NEW;
mp_gcd(&g, &bb, 0, bb, cc->n);
- if (
MP_CMP(g, !=
, MP_ONE)) {
+ if (
!MP_EQ(g
, MP_ONE)) {
mp_drop(aa);
aa = 0;
} else {
mp_drop(aa);
aa = 0;
} else {
@@
-183,7
+186,7
@@
static void prime_mul(void *x, void *y, void *c)
static int prime_eq(void *x, void *y)
{
static int prime_eq(void *x, void *y)
{
- return (MP_
CMP(*(mp **)x, ==
, *(mp **)y));
+ return (MP_
EQ(*(mp **)x
, *(mp **)y));
}
static int prime_split(void *x)
}
static int prime_split(void *x)
@@
-285,7
+288,7
@@
int main(void)
y = mpmont_exp(&mm, MP_NEW, dp.g, x);
mpmont_destroy(&mm);
l = rho_prime(dp.g, y, dp.q, dp.p);
y = mpmont_exp(&mm, MP_NEW, dp.g, x);
mpmont_destroy(&mm);
l = rho_prime(dp.g, y, dp.q, dp.p);
- if (MP_
CMP(x, ==
, l)) {
+ if (MP_
EQ(x
, l)) {
fputs(". ok\n", stdout);
ok = 1;
} else {
fputs(". ok\n", stdout);
ok = 1;
} else {