hashsum.1: Write some notes about compatibility with GNU Coreutils.
[u/mdw/catacomb] / field.h
diff --git a/field.h b/field.h
index 5790284..6085716 100644 (file)
--- a/field.h
+++ b/field.h
@@ -1,13 +1,13 @@
 /* -*-c-*-
  *
- * $Id: field.h,v 1.11 2004/04/08 01:36:15 mdw Exp $
+ * $Id$
  *
  * Definitions for field arithmetic
  *
  * (c) 2000 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of Catacomb.
  *
  * it under the terms of the GNU Library General Public License as
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
- * 
+ *
  * Catacomb is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Library General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Library General Public
  * License along with Catacomb; if not, write to the Free
  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
@@ -56,6 +56,7 @@ typedef struct field {
   mp *m;                               /* Modulus (prime and binary) */
   unsigned long nbits;                 /* Length of field element in bits */
   size_t noctets;                      /* Length of element in octets */
+  mp *q;                               /* Number of elements in field */
 } field;
 
 enum {
@@ -170,6 +171,25 @@ extern int field_samep(field */*f*/, field */*g*/);
 
 extern int field_stdsamep(field */*f*/, field */*g*/);
 
+/*----- Arithmetic --------------------------------------------------------*/
+
+/* --- @field_exp@ --- *
+ *
+ * Arguments:  @field *f@ = pointer to field
+ *             @mp *d@ = fake destination
+ *             @mp *a@ = base
+ *             @mp *e@ = exponent
+ *
+ * Returns:    Result, %$a^e$%.
+ *
+ * Use:                Exponentiation in a finite field.  Note that all quantities
+ *             are in internal format.  This is a generic implementation
+ *             suitable for use with all fields and is not intended to be
+ *             optimal.
+ */
+
+extern mp *field_exp(field */*f*/, mp */*d*/, mp */*a*/, mp */*e*/);
+
 /*----- Creating fields ---------------------------------------------------*/
 
 /* --- @field_prime@ --- *
@@ -188,7 +208,7 @@ extern field *field_prime(mp */*p*/);
  *
  * Arguments:  @mp *p@ = the characteristic of the field
  *
- * Returns:    A pointer to the field.
+ * Returns:    A pointer to the field, or null.
  *
  * Use:                Creates a field structure for a prime field of size %$p$%,
  *             using efficient reduction for nice primes.
@@ -233,7 +253,7 @@ extern field *field_binnorm(mp */*p*/, mp */*beta*/);
  *               * `prime', `niceprime', `binpoly', or `binnorm'
  *               * an optional `:'
  *               * the field modulus
- *               * for `binnorm', an optional `,' and the beta value
+ *               * for `binnorm', an optional `,' and the beta value
  */
 
 extern field *field_parse(qd_parse */*qd*/);