/* * MIRACL C++ Implementation file SF2m12x.cpp * * AUTHOR : M. Scott * * PURPOSE : Implementation of class SF2m12x (special 12-th extension over 2^m) * * WARNING: This class has been cobbled together for a specific use with * the MIRACL library. It is not complete, and may not work in other * applications * */ #include "sf2m12x.h" using namespace std; void SF2m12x::get(GF2m6x& a,GF2m6x& b) {a=U; b=V;} SF2m12x& SF2m12x::powq() { int r=(get_mip())->M%12; U.powq(); V.powq(); if (r==0) return *this; GF2m6x S(0,0,0,1,0,1),T=0; // x^3 + x^5 if (r==7) { // which it is for M=103! T.set(1,0,0,1,0,1); U+=(T*V); return *this; } for (int i=0;i=FM;i--) { // reduce mod x^FM+x^FA+x^FB+x^FC+1 m=t[i]; t[i]=0; t[i-FM]+=m; t[i-(FM-FA)]+=m; #ifdef FB t[i-(FM-FB)]+=m; t[i-(FM-FC)]+=m; #endif } for (i=0;i1) for (i=nb-2;i>=0;) { n=window(k,i,&nbw,&nzs,5); for (j=0;j0) u*=t[n/2]; i-=nbw; if (nzs) { for (j=0;j