/* -*-c-*-
*
- * $Id: field.h,v 1.11 2004/04/08 01:36:15 mdw Exp $
+ * $Id$
*
* Definitions for field arithmetic
*
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 {
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@ --- *
*
* 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.