cangrepp

Some cryptographic attacks
Log | Files | Refs | README

hnp.h (783B)


      1 #ifndef HNP_H
      2 #define HNP_H
      3 
      4 #include <flint.h>
      5 #include <fmpq.h>
      6 #include <fmpz.h>
      7 #include <fmpz_mat.h>
      8 #include <gmp.h>
      9 
     10 /**
     11  * Solve the hidden number problem
     12  *   t[i]*alpha - a[i]  == b[i] (mod n),  i = 0,1,...,m-1
     13  * for
     14  *   b[i],  i = 0,1,...,m-1, and
     15  *   alpha
     16  * where |b[i]| < B.
     17  *
     18  * @param res
     19  *   an already initialised vector that has size nres, this vector
     20  *   may be overwritten even if the result is not verified
     21  * @return
     22  *   -1 if failure (ex. res too small to fit m+1 values)
     23  *    1 if reduction okay, but solution fails to verify
     24  *    0 if solution found
     25  */
     26 int hidden_number_problem(fmpz *res, const slong nres, const fmpz *t,
     27                           const fmpz *a, const slong m, const fmpz_t n,
     28                           const fmpz_t B);
     29 
     30 #endif