|
@@ -12,22 +12,26 @@ int main(void)
|
|
|
Scalar test1(1);
|
|
|
Scalar test3(3);
|
|
|
Scalar test5(5);
|
|
|
- Scalar decrypted0, decrypted1, decrypted3, decrypted5, decrypted6, decrypted10, decrypted15, decrypted30;
|
|
|
+ Scalar test6(6);
|
|
|
+ Scalar test10(10);
|
|
|
+ Scalar test15(15);
|
|
|
+ Scalar test30(30);
|
|
|
+
|
|
|
+ Scalar decrypted;
|
|
|
|
|
|
std::cout << "Scalar test value (0): " << test0 << std::endl;
|
|
|
-
|
|
|
+ std::cout << "Scalar test value (1): " << test1 << std::endl;
|
|
|
std::cout << "Scalar test value (3): " << test3 << std::endl;
|
|
|
std::cout << "Scalar test value (5): " << test5 << std::endl;
|
|
|
|
|
|
CurveBipoint encrypted0, encrypted1, encrypted3, encrypted6;
|
|
|
-
|
|
|
TwistBipoint encrypted5, encrypted10;
|
|
|
Quadripoint encrypted15, encrypted30;
|
|
|
|
|
|
std::cout << "Performing encryptions" << std::endl;
|
|
|
|
|
|
system.encrypt(encrypted0, test0);
|
|
|
-
|
|
|
+ system.encrypt(encrypted1, test1);
|
|
|
system.encrypt(encrypted3, test3);
|
|
|
system.encrypt(encrypted5, test5);
|
|
|
|
|
@@ -46,29 +50,68 @@ int main(void)
|
|
|
|
|
|
std::cout << "Performing decryptions" << std::endl;
|
|
|
|
|
|
- decrypted0 = system.decrypt(encrypted0);
|
|
|
- std::cout << "Scalar decrypted value (0): " << decrypted0 << 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;
|
|
|
+ decrypted = system.decrypt(encrypted0);
|
|
|
+ std::cout << "Decryption of point at infinity (0): ";
|
|
|
+ if (decrypted == test0)
|
|
|
+ std::cout << "PASS" << std::endl;
|
|
|
+ else
|
|
|
+ std::cout << "FAIL" << std::endl;
|
|
|
+
|
|
|
+ decrypted = system.decrypt(encrypted1);
|
|
|
+ std::cout << "Decryption of generator (1): ";
|
|
|
+ if (decrypted == test1)
|
|
|
+ std::cout << "PASS" << std::endl;
|
|
|
+ else
|
|
|
+ std::cout << "FAIL" << std::endl;
|
|
|
+
|
|
|
+ decrypted = system.decrypt(encrypted1);
|
|
|
+ std::cout << "Memoization: ";
|
|
|
+ if (decrypted == test1)
|
|
|
+ std::cout << "PASS" << std::endl;
|
|
|
+ else
|
|
|
+ std::cout << "FAIL" << std::endl;
|
|
|
+
|
|
|
+ decrypted = system.decrypt(encrypted3);
|
|
|
+ std::cout << "Decryption of normal point in G (3): ";
|
|
|
+ if (decrypted == test3)
|
|
|
+ std::cout << "PASS" << std::endl;
|
|
|
+ else
|
|
|
+ std::cout << "FAIL" << std::endl;
|
|
|
+
|
|
|
+ decrypted = system.decrypt(encrypted5);
|
|
|
+ std::cout << "Decryption of normal point in H (5): ";
|
|
|
+ if (decrypted == test5)
|
|
|
+ std::cout << "PASS" << std::endl;
|
|
|
+ else
|
|
|
+ std::cout << "FAIL" << std::endl;
|
|
|
+
|
|
|
+ decrypted = system.decrypt(encrypted6);
|
|
|
+ std::cout << "Addition in G: ";
|
|
|
+ if (decrypted == test6)
|
|
|
+ std::cout << "PASS" << std::endl;
|
|
|
+ else
|
|
|
+ std::cout << "FAIL" << std::endl;
|
|
|
+
|
|
|
+ decrypted = system.decrypt(encrypted10);
|
|
|
+ std::cout << "Addition in H: ";
|
|
|
+ if (decrypted == test10)
|
|
|
+ std::cout << "PASS" << std::endl;
|
|
|
+ else
|
|
|
+ std::cout << "FAIL" << std::endl;
|
|
|
+
|
|
|
+ decrypted = system.decrypt(encrypted15);
|
|
|
+ std::cout << "Multiplication (G by H): ";
|
|
|
+ if (decrypted == test15)
|
|
|
+ std::cout << "PASS" << std::endl;
|
|
|
+ else
|
|
|
+ std::cout << "FAIL" << std::endl;
|
|
|
+
|
|
|
+ decrypted = system.decrypt(encrypted30);
|
|
|
+ std::cout << "Addition in G_T: ";
|
|
|
+ if (decrypted == test30)
|
|
|
+ std::cout << "PASS" << std::endl;
|
|
|
+ else
|
|
|
+ std::cout << "FAIL" << std::endl;
|
|
|
|
|
|
return 0;
|
|
|
}
|