Skip to content

Commit

Permalink
try/except to get past NTRU support size error
Browse files Browse the repository at this point in the history
  • Loading branch information
bencrts committed Feb 6, 2024
1 parent d92bfca commit 65c31fc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions estimator/lwe_primal.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,14 @@ def find_zeta_max(params, red_cost_model):
usvp_cost = primal_usvp(params, red_cost_model=red_cost_model)["rop"]
zeta_max = 1
while zeta_max < params.n:
if params.Xs.support_size(zeta_max) > usvp_cost:
# double it for mitm
return 2 * zeta_max
zeta_max +=1
# TODO: once support_size() is supported for NTRU, remove the below try/except
try:
if params.Xs.support_size(zeta_max) > usvp_cost:
# double it for mitm
return 2 * zeta_max
zeta_max +=1
except:
return params.n
return params.n

if zeta is None:
Expand Down

0 comments on commit 65c31fc

Please sign in to comment.