Fp.hpp 821 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef __FP_HPP
  2. #define __FP_HPP
  3. //#include "bgn.hpp"
  4. #include "mydouble.h"
  5. extern "C" {
  6. #include "fpe.h"
  7. #ifdef NEW_PARAMETERS
  8. #include "scalar_512.h"
  9. #else
  10. #include "scalar.h"
  11. #endif
  12. }
  13. //#include "fpe2scalar.hpp"
  14. class Fp
  15. {
  16. friend class PrivateKey; //nécessaire pour fournir à PrivateKey l'accès aux membres privés de Fp.
  17. friend class PublicKey;
  18. public:
  19. void set(fpe_t fpe);
  20. void set_random();
  21. void set_ad_minus_bc(Fp b,Fp c,Fp d);
  22. const scalar_t& scalar() const; //problem declared as function returning an array --> solution passage en réference de la valeur de retour
  23. void print_fpe() const;
  24. Fp operator*(Fp b); // there is already one implicit parameter: the object for which the method is invoked!
  25. Fp operator-();
  26. private:
  27. scalar_t scalar_rep={};
  28. fpe_t fpe_rep;
  29. };
  30. #endif