cangrepp

Some cryptographic attacks
Log | Files | Refs | README

small.c (550B)


      1 #include <fmpz.h>
      2 #include <stdint.h>
      3 #include <stdio.h>
      4 #include <stdlib.h>
      5 
      6 #include "context.h"
      7 #include "fmpzio.h"
      8 #include "smallfactor.h"
      9 
     10 int
     11 main(void)
     12 {
     13   fmpz_t read, factor;
     14   ctx_t ctx;
     15   fmpz_init(factor);
     16   fmpz_init(read);
     17 
     18   ctx_init(&ctx);
     19   ctx_set_precomputed_primorial(&ctx);
     20   ctx_set_precomputed_smallprimes(&ctx);
     21 
     22   while (read_next_hex_fmpz(read) == 0) {
     23     smallfactor_euclidean(&ctx, factor, read);
     24     fmpz_print(factor);
     25     printf("\n");
     26   }
     27 
     28   ctx_clear(&ctx);
     29   fmpz_clear(factor);
     30   fmpz_clear(read);
     31 
     32   return 0;
     33 }