Files
concrete/tools/parameter-curves/concrete-security-curves-cpp/gen_header.py
youben11 e92a0d9fa8 fix(tools): remove vector init in header
vector init can't be in a header file, and there was a double free due
to its usage in two different locations. We now use simple arrays to
store the list of available security curves
2023-06-27 14:21:42 +01:00

14 lines
430 B
Python

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("SecurityCurve curves[] = {")
for data in datas:
print_curve(data)
print("};\n")
print(f"size_t curvesLen = {len(data)};")
print_cpp_curves_declaration(json.load(sys.stdin))