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>
45 lines
1.1 KiB
Python
Executable File
45 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env sage
|
|
proof.all(False) # faster
|
|
|
|
################################################################
|
|
|
|
from parameters import p
|
|
negl = 2**-64
|
|
|
|
################################################################
|
|
|
|
logp = ceil(log(p, 2))
|
|
loglogp = ceil(log(logp,2))
|
|
tors2val = (p+1).valuation(2)
|
|
|
|
defs = dict()
|
|
|
|
# RepresentInteger data
|
|
small = ceil(log(negl, 2) / -1)
|
|
assert 2**-small <= negl
|
|
|
|
add_shift = ceil(log(log(negl, 1-1/(64*logp)), 2))
|
|
assert (1 - 1/(64*logp)) ** (2**(add_shift)) <= negl
|
|
|
|
defs['QUAT_primality_num_iter'] = ceil(-log(negl, 4))
|
|
defs['QUAT_repres_bound_input'] = add_shift
|
|
|
|
# Equivalent ideal data
|
|
defs['QUAT_equiv_bound_coeff'] = 2**(1 + add_shift//4)
|
|
|
|
# Find_uv constants
|
|
m = 2 + floor((logp - tors2val) / 4)
|
|
defs['FINDUV_box_size'] = m
|
|
defs['FINDUV_cube_size'] = (2 * m + 1)**4 - 1
|
|
|
|
################################################################
|
|
|
|
with open('include/quaternion_constants.h','w') as hfile:
|
|
print(f'#include <quaternion.h>', file=hfile)
|
|
|
|
for k,v in defs.items():
|
|
v = ZZ(v)
|
|
print(f'#define {k} {v}', file=hfile)
|
|
|
|
|