Curvepoint.hpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef __CURVEPOINT_HPP
  2. #define __CURVEPOINT_HPP
  3. #include <ostream>
  4. #include <functional>
  5. #include "Scalar.hpp"
  6. #include "print_helpers.hpp"
  7. extern "C" {
  8. #include "curvepoint_fp.h"
  9. }
  10. class Curvepoint
  11. {
  12. public:
  13. Curvepoint();
  14. Curvepoint(const curvepoint_fp_t input);
  15. curvepoint_fp_t& toCurvepointFpT();
  16. const curvepoint_fp_t& toCurvepointFpT() const;
  17. Curvepoint operator+(const Curvepoint& b) const;
  18. Curvepoint operator-(const Curvepoint& b) const;
  19. Curvepoint operator*(const Scalar& mult) const;
  20. bool operator==(const Curvepoint& b) const;
  21. bool operator<(const Curvepoint& b) const;
  22. bool operator>(const Curvepoint& b) const;
  23. bool operator<=(const Curvepoint& b) const;
  24. bool operator>=(const Curvepoint& b) const;
  25. bool operator!=(const Curvepoint& b) const;
  26. void make_affine();
  27. friend class CurvepointHash;
  28. friend class CurveBipoint;
  29. friend std::ostream& operator<<(std::ostream& os, const Curvepoint& output);
  30. friend std::istream& operator>>(std::istream& is, Curvepoint& input);
  31. private:
  32. curvepoint_fp_t point;
  33. };
  34. class CurvepointHash
  35. {
  36. public:
  37. size_t operator()(const Curvepoint& x) const;
  38. };
  39. class Twistpoint
  40. {
  41. public:
  42. Twistpoint();
  43. Twistpoint(const twistpoint_fp2_t input);
  44. twistpoint_fp2_t& toTwistpointFp2T();
  45. const twistpoint_fp2_t& toTwistpointFp2T() const;
  46. Twistpoint operator+(const Twistpoint& b) const;
  47. Twistpoint operator-(const Twistpoint& b) const;
  48. Twistpoint operator*(const Scalar& mult) const;
  49. bool operator==(const Twistpoint& b) const;
  50. bool operator<(const Twistpoint& b) const;
  51. bool operator>(const Twistpoint& b) const;
  52. bool operator<=(const Twistpoint& b) const;
  53. bool operator>=(const Twistpoint& b) const;
  54. bool operator!=(const Twistpoint& b) const;
  55. void make_affine();
  56. friend class TwistpointHash;
  57. friend class TwistBipoint;
  58. friend std::ostream& operator<<(std::ostream& os, const Twistpoint& output);
  59. friend std::istream& operator>>(std::istream& is, Twistpoint& input);
  60. private:
  61. twistpoint_fp2_t point;
  62. };
  63. class TwistpointHash
  64. {
  65. public:
  66. size_t operator()(const Twistpoint& x) const;
  67. };
  68. #endif