second-round version of SQIsign
Co-authored-by: Marius A. Aardal <marius.andre.aardal@gmail.com> Co-authored-by: Gora Adj <gora.adj@tii.ae> Co-authored-by: Diego F. Aranha <dfaranha@cs.au.dk> Co-authored-by: Andrea Basso <sqisign@andreabasso.com> Co-authored-by: Isaac Andrés Canales Martínez <icanalesm0500@gmail.com> Co-authored-by: Jorge Chávez-Saab <jorgechavezsaab@gmail.com> Co-authored-by: Maria Corte-Real Santos <mariascrsantos98@gmail.com> Co-authored-by: Luca De Feo <github@defeo.lu> Co-authored-by: Max Duparc <max.duparc@epfl.ch> Co-authored-by: Jonathan Komada Eriksen <jonathan.eriksen97@gmail.com> Co-authored-by: Décio Luiz Gazzoni Filho <decio@decpp.net> Co-authored-by: Basil Hess <bhe@zurich.ibm.com> Co-authored-by: Antonin Leroux <antonin.leroux@polytechnique.org> Co-authored-by: Patrick Longa <plonga@microsoft.com> Co-authored-by: Luciano Maino <mainoluciano.96@gmail.com> Co-authored-by: Michael Meyer <michael@random-oracles.org> Co-authored-by: Hiroshi Onuki <onuki@mist.i.u-tokyo.ac.jp> Co-authored-by: Lorenz Panny <lorenz@yx7.cc> Co-authored-by: Giacomo Pope <giacomopope@gmail.com> Co-authored-by: Krijn Reijnders <reijnderskrijn@gmail.com> Co-authored-by: Damien Robert <damien.robert@inria.fr> Co-authored-by: Francisco Rodríguez-Henriquez <francisco.rodriguez@tii.ae> Co-authored-by: Sina Schaeffler <sschaeffle@student.ethz.ch> Co-authored-by: Benjamin Wesolowski <benjamin.wesolowski@ens-lyon.fr>
This commit is contained in:
committed by
Lorenz Panny
parent
ff34a8cd18
commit
91e9e464fe
41
scripts/precomp/ec_params.sage
Executable file
41
scripts/precomp/ec_params.sage
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from sage.all import *
|
||||
from parameters import p, f
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
cof = (p+1)//(2**f)
|
||||
|
||||
from cformat import Object, ObjectFormatter
|
||||
|
||||
obj_cof = ObjectFormatter(
|
||||
[
|
||||
Object('digit_t[]', 'p_cofactor_for_2f', [cof]),
|
||||
]
|
||||
)
|
||||
|
||||
with open("include/ec_params.h", "w") as hfile:
|
||||
with open("ec_params.c", "w") as cfile:
|
||||
|
||||
hfile.write('#ifndef EC_PARAMS_H\n')
|
||||
hfile.write('#define EC_PARAMS_H\n')
|
||||
hfile.write('\n')
|
||||
|
||||
hfile.write('#include <fp.h>\n')
|
||||
cfile.write('#include <ec_params.h>\n')
|
||||
hfile.write('\n')
|
||||
|
||||
hfile.write(f'#define TORSION_EVEN_POWER {f}\n')
|
||||
hfile.write('\n')
|
||||
|
||||
hfile.write('// p+1 divided by the power of 2\n')
|
||||
cfile.write('// p+1 divided by the power of 2\n')
|
||||
obj_cof.header(file=hfile)
|
||||
obj_cof.implementation(file=cfile)
|
||||
hfile.write(f'#define P_COFACTOR_FOR_2F_BITLENGTH {((p+1)//(2**f)).bit_length()}\n')
|
||||
hfile.write('\n')
|
||||
cfile.write('\n')
|
||||
|
||||
|
||||
hfile.write('#endif\n')
|
||||
Reference in New Issue
Block a user