projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add new functions.
[u/mdw/catacomb]
/
mpcrt.h
diff --git
a/mpcrt.h
b/mpcrt.h
index
5474a92
..
a5dd71c
100644
(file)
--- a/
mpcrt.h
+++ b/
mpcrt.h
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: mpcrt.h,v 1.
1 1999/11/22 20:50:57
mdw Exp $
+ * $Id: mpcrt.h,v 1.
2 1999/12/10 23:22:32
mdw Exp $
*
* Chinese Remainder Theorem computations (Gauss's algorithm)
*
*
* Chinese Remainder Theorem computations (Gauss's algorithm)
*
@@
-30,13
+30,16
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: mpcrt.h,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: mpcrt.h,v $
+ * Revision 1.2 1999/12/10 23:22:32 mdw
+ * Interface changes for suggested destinations. Use Barrett reduction.
+ *
* Revision 1.1 1999/11/22 20:50:57 mdw
* Add support for solving Chinese Remainder Theorem problems.
*
*/
* Revision 1.1 1999/11/22 20:50:57 mdw
* Add support for solving Chinese Remainder Theorem problems.
*
*/
-#ifndef MPCRT_H
-#define MPCRT_H
+#ifndef
CATACOMB_
MPCRT_H
+#define
CATACOMB_
MPCRT_H
#ifdef __cplusplus
extern "C" {
#ifdef __cplusplus
extern "C" {
@@
-46,12
+49,12
@@
#include <stddef.h>
#include <stddef.h>
-#ifndef MP_H
+#ifndef
CATACOMB_
MP_H
# include "mp.h"
#endif
# include "mp.h"
#endif
-#ifndef
MPMON
T_H
-# include "mp
mon
t.h"
+#ifndef
CATACOMB_MPBARRET
T_H
+# include "mp
barret
t.h"
#endif
/*----- Data structures ---------------------------------------------------*/
#endif
/*----- Data structures ---------------------------------------------------*/
@@
-60,12
+63,12
@@
typedef struct mpcrt_mod {
mp *m; /* %$n_i$% -- the modulus */
mp *n; /* %$N_i = n / n_i$% */
mp *ni; /* %$M_i = N_i^{-1} \bmod n_i$% */
mp *m; /* %$n_i$% -- the modulus */
mp *n; /* %$N_i = n / n_i$% */
mp *ni; /* %$M_i = N_i^{-1} \bmod n_i$% */
- mp *nni
r; /* %$N_i M_i R
\bmod m$% */
+ mp *nni
; /* %$N_i M_i
\bmod m$% */
} mpcrt_mod;
typedef struct mpcrt {
size_t k; /* Number of distinct moduli */
} mpcrt_mod;
typedef struct mpcrt {
size_t k; /* Number of distinct moduli */
- mp
mont mm; /* Montgomery
context for product */
+ mp
barrett mb; /* Barrett
context for product */
mpcrt_mod *v; /* Vector of information for each */
} mpcrt;
mpcrt_mod *v; /* Vector of information for each */
} mpcrt;
@@
-107,6
+110,7
@@
extern void mpcrt_destroy(mpcrt */*c*/);
/* --- @mpcrt_solve@ --- *
*
* Arguments: @mpcrt *c@ = pointer to CRT context
/* --- @mpcrt_solve@ --- *
*
* Arguments: @mpcrt *c@ = pointer to CRT context
+ * @mp *d@ = fake destination
* @mp **v@ = array of residues
*
* Returns: The unique solution modulo the product of the individual
* @mp **v@ = array of residues
*
* Returns: The unique solution modulo the product of the individual
@@
-121,7
+125,7
@@
extern void mpcrt_destroy(mpcrt */*c*/);
* exponentiation.
*/
* exponentiation.
*/
-extern mp *mpcrt_solve(mpcrt */*c*/, mp **/*v*/);
+extern mp *mpcrt_solve(mpcrt */*c*/, mp *
/*d*/, mp *
*/*v*/);
/*----- That's all, folks -------------------------------------------------*/
/*----- That's all, folks -------------------------------------------------*/