Bipoint.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef __BIPOINT_HPP
  2. #define __BIPOINT_HPP
  3. #include <functional>
  4. #include "Scalar.hpp"
  5. extern "C" {
  6. #include "curvepoint_fp.h"
  7. #include "twistpoint_fp2.h"
  8. }
  9. class CurveBipoint
  10. {
  11. public:
  12. CurveBipoint();
  13. CurveBipoint(curvepoint_fp_t p1, curvepoint_fp_t p2);
  14. curvepoint_fp_t& operator[](int n);
  15. const curvepoint_fp_t& operator[](int n) const;
  16. CurveBipoint operator+(const CurveBipoint& b) const;
  17. CurveBipoint operator*(const Scalar& mult) const;
  18. bool operator==(const CurveBipoint& b) const;
  19. bool operator!=(const CurveBipoint& b) const;
  20. // "double" is a type, so you can't just name the function that I don't think, but that's all this is
  21. CurveBipoint mult_by_2() const;
  22. void make_affine();
  23. friend class CurveBipointHash;
  24. private:
  25. curvepoint_fp_t point[2];
  26. };
  27. class CurveBipointHash
  28. {
  29. public:
  30. size_t operator()(const CurveBipoint& x) const;
  31. };
  32. class TwistBipoint
  33. {
  34. public:
  35. TwistBipoint();
  36. TwistBipoint(twistpoint_fp2_t p1, twistpoint_fp2_t p2);
  37. twistpoint_fp2_t& operator[](int n);
  38. const twistpoint_fp2_t& operator[](int n) const;
  39. TwistBipoint operator+(const TwistBipoint& b) const;
  40. TwistBipoint operator*(const Scalar& mult) const;
  41. bool operator==(const TwistBipoint& b) const;
  42. bool operator!=(const TwistBipoint& b) const;
  43. // "double" is a type, so you can't just name the function that I don't think, but that's all this is
  44. TwistBipoint mult_by_2() const;
  45. void make_affine();
  46. friend class TwistBipointHash;
  47. private:
  48. twistpoint_fp2_t point[2];
  49. };
  50. class TwistBipointHash
  51. {
  52. public:
  53. size_t operator()(const TwistBipoint& x) const;
  54. };
  55. #endif