X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/ceb3f0c0a3b7bb3fa3250d31b04c382894095e52..b2776fdf2a98ea586bbdad50eca4ed95e967b0d7:/gf.h diff --git a/gf.h b/gf.h index 889cd9b..8de8231 100644 --- a/gf.h +++ b/gf.h @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: gf.h,v 1.1.2.1 2004/03/21 22:39:46 mdw Exp $ + * $Id$ * * Arithmetic on binary polynomials * * (c) 2004 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,26 +15,18 @@ * 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, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: gf.h,v $ - * Revision 1.1.2.1 2004/03/21 22:39:46 mdw - * Elliptic curves on binary fields work. - * - */ - #ifndef CATACOMB_GF_H #define CATACOMB_GF_H @@ -99,6 +91,26 @@ extern mp *gf_sqr(mp */*d*/, mp */*a*/); extern void gf_div(mp **/*qq*/, mp **/*rr*/, mp */*a*/, mp */*b*/); +/* --- @gf_exp@ --- * + * + * Arguments: @mp *d@ = fake destination + * @mp *a@ = base + * @mp *e@ = exponent + * + * Returns: Result, %$a^e$%. + */ + +extern mp *gf_exp(mp */*d*/, mp */*a*/, mp */*e*/); + +/* --- @gf_irreduciblep@ --- * + * + * Arguments: @mp *f@ = a polynomial + * + * Returns: Nonzero if the polynomial is irreducible; otherwise zero. + */ + +extern int gf_irreduciblep(mp */*f*/); + /* --- @gf_gcd@ --- * * * Arguments: @mp **gcd, **xx, **yy@ = where to write the results @@ -115,6 +127,21 @@ extern void gf_div(mp **/*qq*/, mp **/*rr*/, mp */*a*/, mp */*b*/); extern void gf_gcd(mp **/*gcd*/, mp **/*xx*/, mp **/*yy*/, mp */*a*/, mp */*b*/); +/* -- @gf_modinv@ --- * + * + * Arguments: @mp *d@ = destination + * @mp *x@ = argument + * @mp *p@ = modulus + * + * Returns: The inverse %$x^{-1} \bmod p$%. + * + * Use: Computes a modular inverse, the catch being that the + * arguments and results are binary polynomials. An assertion + * fails if %$p$% has no inverse. + */ + +extern mp *gf_modinv(mp */*d*/, mp */*x*/, mp */*p*/); + /*----- That's all, folks -------------------------------------------------*/ #ifdef __cplusplus