main.cpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #include <iostream>
  2. #include "BGN.hpp"
  3. int main(void)
  4. {
  5. BGN system;
  6. // const PrivateKey sk = system.get_private_key();
  7. Scalar test3(0);
  8. Scalar test5(5);
  9. Scalar decrypted3, decrypted5, decrypted6, decrypted10, decrypted15, decrypted30;
  10. std::cout << "Scalar test value (3): " << test3 << std::endl;
  11. std::cout << "Scalar test value (5): " << test5 << std::endl;
  12. CurveBipoint encrypted3, encrypted6;
  13. // CurveBipoint pi_1_encrypted3, pi_1_curvegen_times3;
  14. TwistBipoint encrypted5, encrypted10;
  15. Quadripoint encrypted15, encrypted30;
  16. std::cout << "Performing encryptions" << std::endl;
  17. system.encrypt(encrypted3, test3);
  18. // pi_1_encrypted3 = sk.pi_1(encrypted3);
  19. // pi_1_encrypted3.make_affine();
  20. // pi_1_curvegen_times3 = sk.pi_1_curvegen * test3;
  21. // pi_1_curvegen_times3.make_affine();
  22. // std::cout << std:: endl;
  23. // std::cout << "Partially decrypted test value (3): " << pi_1_encrypted3 << std::endl;
  24. // std::cout << std:: endl;
  25. // std::cout << "What it should match up to (3): " << pi_1_curvegen_times3 << std::endl;
  26. // std::cout << std:: endl;
  27. // system.encrypt(encrypted5, test5);
  28. // std::cout << "Performing additions" << std::endl;
  29. // encrypted6 = system.homomorphic_addition(encrypted3, encrypted3);
  30. // encrypted10 = system.homomorphic_addition(encrypted5, encrypted5);
  31. // std::cout << "Performing multiplication" << std::endl;
  32. // encrypted15 = system.homomorphic_multiplication(encrypted3, encrypted5);
  33. // std::cout << "Performing L2 addition" << std::endl;
  34. // encrypted30 = system.homomorphic_addition(encrypted15, encrypted15);
  35. // std::cout << "Performing decryptions" << std::endl;
  36. decrypted3 = system.decrypt(encrypted3);
  37. std::cout << "Scalar decrypted value (3): " << decrypted3 << std::endl;
  38. // decrypted5 = system.decrypt(encrypted5);
  39. // std::cout << "Scalar decrypted value (5): " << decrypted5 << std::endl;
  40. // decrypted6 = system.decrypt(encrypted6);
  41. // std::cout << "Scalar decrypted value (6): " << decrypted6 << std::endl;
  42. // decrypted10 = system.decrypt(encrypted10);
  43. // std::cout << "Scalar decrypted value (10): " << decrypted10 << std::endl;
  44. // decrypted15 = system.decrypt(encrypted15);
  45. // std::cout << "Scalar decrypted value (15): " << decrypted15 << std::endl;
  46. // decrypted30 = system.decrypt(encrypted30);
  47. // std::cout << "Scalar decrypted value (30): " << decrypted30 << std::endl;
  48. return 0;
  49. }