BitChiffre.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #include "BitChiffre.hpp"
  2. Type BitChiffre::get_type() const
  3. {
  4. return type;
  5. }
  6. void BitChiffre::print() const
  7. {
  8. cout << "____________" << endl;
  9. zout(bit_masque);
  10. JUMP;
  11. if (type == CURVE)
  12. {
  13. cout << RED << "si bit_urandom=0 affichage du bipoint u1=(lambda1*i1*g, lambda1*j1*g)" << RESET << endl;
  14. bipoint_curve.print();
  15. }
  16. if (type == TWIST)
  17. {
  18. bipoint_twist.print();
  19. }
  20. cout << "____________" << endl;
  21. }
  22. void BitChiffre::print_bit_masque() const
  23. {
  24. zout(bit_masque);
  25. }
  26. Bipoint<curvepoint_fp_t> BitChiffre::get_bipoint_curve() const
  27. {
  28. return bipoint_curve;
  29. }
  30. Bipoint<twistpoint_fp2_t> BitChiffre::get_bipoint_twist() const
  31. {
  32. return bipoint_twist;
  33. }
  34. BitChiffre::BitChiffre(F2 a,Bipoint<curvepoint_fp_t> b ,Bipoint<twistpoint_fp2_t> c)
  35. {
  36. bit_masque = a;
  37. bipoint_curve = b;
  38. bipoint_twist = c;
  39. }
  40. void BitChiffre::set_bit_masque(F2 bit)
  41. //manipulateur pour modifer attribut si nécessaire, méthode définie en dehors de la classe
  42. {
  43. bit_masque = bit;
  44. }
  45. F2 BitChiffre::get_bit_masque() const
  46. {
  47. return bit_masque;
  48. }
  49. void BitChiffre::set_bipoint_curve(Bipoint<curvepoint_fp_t> b)
  50. {
  51. bipoint_curve = b;
  52. type=CURVE;
  53. }
  54. void BitChiffre::set_bipoint_twist(Bipoint<twistpoint_fp2_t> c)
  55. {
  56. bipoint_twist = c;
  57. type=TWIST;
  58. }
  59. void BitChiffre::makeaffine()
  60. {
  61. bipoint_curve.makeaffine();
  62. bipoint_twist.makeaffine();
  63. }