modular polynomial multiplication for 155bit

#include <stdio.h>
#include "field2n.h"
#include "poly.h"

extern FIELD2N poly_prime;

int main(){
   FIELD2N a = {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008}; 
   FIELD2N b = {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002}; 
   if (!irreducible(&poly_prime)) return(0);
      print_field("poly_prime = ", &poly_prime);

   printf("\nNUMBITS = %d", NUMBITS);
   printf("\nNUMWORD = %d", NUMWORD);
   printf("\nMAXLONG = %d\n", MAXLONG);

   FIELD2N c;
   null(&c);

   poly_mul(&a, &b, &c);

   print_field("a", &a);
   print_field("b", &b);
   print_field("c", &c);
   print_field("poly_prime", &poly_prime);

   return 0;
}


NUMBITS = 155
NUMWORD = 4
MAXLONG = 5
a
0 0 0 0 8
b
0 0 0 0 2
c
0 0 0 0 10
poly_prime
8000000 0 0 0 b1

Advertisements