enhance: Refactor the cpp code to be more generic and easy to generate

This commit is contained in:
Quentin Bourgerie
2022-12-14 12:30:43 +01:00
parent 4e1197f2d7
commit 7e8792ed34
13 changed files with 131 additions and 299 deletions

12
cpp/gen_header.py Normal file
View File

@@ -0,0 +1,12 @@
import sys, json;
def print_curve(data):
print(f'\tSecurityCurve({data["security_level"]},{data["slope"]}, {data["bias"]}, {data["minimal_lwe_dimension"]}, KeyFormat::BINARY),')
def print_cpp_curves_declaration(datas):
print("std::vector<SecurityCurve> curves {")
for data in datas:
print_curve(data)
print("}\n")
print_cpp_curves_declaration(json.load(sys.stdin))