1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #include <iostream>
- #include "BGN.hpp"
- int main(void)
- {
- BGN system;
- // const PrivateKey sk = system.get_private_key();
- Scalar test3(0);
- Scalar test5(5);
- Scalar decrypted3, decrypted5, decrypted6, decrypted10, decrypted15, decrypted30;
- std::cout << "Scalar test value (3): " << test3 << std::endl;
- std::cout << "Scalar test value (5): " << test5 << std::endl;
- CurveBipoint encrypted3, encrypted6;
- // CurveBipoint pi_1_encrypted3, pi_1_curvegen_times3;
- TwistBipoint encrypted5, encrypted10;
- Quadripoint encrypted15, encrypted30;
- std::cout << "Performing encryptions" << std::endl;
- system.encrypt(encrypted3, test3);
- // pi_1_encrypted3 = sk.pi_1(encrypted3);
- // pi_1_encrypted3.make_affine();
- // pi_1_curvegen_times3 = sk.pi_1_curvegen * test3;
- // pi_1_curvegen_times3.make_affine();
- // std::cout << std:: endl;
- // std::cout << "Partially decrypted test value (3): " << pi_1_encrypted3 << std::endl;
- // std::cout << std:: endl;
- // std::cout << "What it should match up to (3): " << pi_1_curvegen_times3 << std::endl;
- // std::cout << std:: endl;
- // system.encrypt(encrypted5, test5);
- // std::cout << "Performing additions" << std::endl;
- // encrypted6 = system.homomorphic_addition(encrypted3, encrypted3);
- // encrypted10 = system.homomorphic_addition(encrypted5, encrypted5);
- // std::cout << "Performing multiplication" << std::endl;
- // encrypted15 = system.homomorphic_multiplication(encrypted3, encrypted5);
- // std::cout << "Performing L2 addition" << std::endl;
- // encrypted30 = system.homomorphic_addition(encrypted15, encrypted15);
- // std::cout << "Performing decryptions" << std::endl;
- decrypted3 = system.decrypt(encrypted3);
- std::cout << "Scalar decrypted value (3): " << decrypted3 << std::endl;
- // decrypted5 = system.decrypt(encrypted5);
- // std::cout << "Scalar decrypted value (5): " << decrypted5 << std::endl;
- // decrypted6 = system.decrypt(encrypted6);
- // std::cout << "Scalar decrypted value (6): " << decrypted6 << std::endl;
- // decrypted10 = system.decrypt(encrypted10);
- // std::cout << "Scalar decrypted value (10): " << decrypted10 << std::endl;
- // decrypted15 = system.decrypt(encrypted15);
- // std::cout << "Scalar decrypted value (15): " << decrypted15 << std::endl;
- // decrypted30 = system.decrypt(encrypted30);
- // std::cout << "Scalar decrypted value (30): " << decrypted30 << std::endl;
- return 0;
- }
|