/* * program to calculate modquare/modmult, inverse/modmult, * jacobi/modmult and modadd/modmult ratios */ #include #include "miracl.h" #include #define MIN_TIME 15.0 int sizes[]={160,256,512,640}; int num_sizes=4; int main() { time_t seed; int i,j,k,bits; long iterations; big x,nx,y,ny,n,w; clock_t start; double square_time,mult_time,xgcd_time,jac_time,add_time; #ifndef MR_NOFULLWIDTH mirsys(80,0); #else mirsys(80,MAXBASE); #endif x=mirvar(0); nx=mirvar(0); y=mirvar(0); ny=mirvar(0); n=mirvar(0); w=mirvar(0); printf("MIRACL - %d bit version\n",MIRACL); #ifdef MR_LITTLE_ENDIAN printf("Little Endian processor\n"); #endif #ifdef MR_BIG_ENDIAN printf("Big Endian processor\n"); #endif #ifdef MR_NOASM printf("C-Only Version of MIRACL\n"); #else printf("Using some assembly language\n"); #endif #ifdef MR_STRIPPED_DOWN printf("Stripped down version of MIRACL - no error messages\n"); #endif #ifdef MR_KCM k=MR_KCM*MIRACL; printf("Using KCM method \n"); printf("Optimized for %d, %d, %d, %d...etc. bit moduli\n",k,k*2,k*4,k*8); #endif #ifdef MR_COMBA k=MR_COMBA*MIRACL; printf("Using COMBA method \n"); printf("Optimized for %d bit moduli\n",k); #endif #ifdef MR_PENTIUM printf("Floating-point co-processor arithmetic used for Pentium\n"); #endif #ifndef MR_KCM #ifndef MR_COMBA #ifndef MR_PENTIUM printf("No special optimizations\n"); #endif #endif #endif #ifdef MR_NOFULLWIDTH printf("No Fullwidth base possible\n"); #endif printf("NOTE: times are elapsed real-times - so make sure nothing else is running!\n\n"); time(&seed); irand((unsigned long)seed); printf("Calculating Modsquare/Modmult, Inverse/Modmult, Jacobi/Modmult Modadd/Modmult ratios\n"); printf("Please Wait......\n"); for (j=0;j