Skip to content

Commit

Permalink
change NTRU primal doctests to HRSS701Enc to avoid exception
Browse files Browse the repository at this point in the history
  • Loading branch information
hkippen-SBAQ committed Nov 7, 2023
1 parent ca2b26e commit 4a1389f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 6 additions & 6 deletions estimator/ntru.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ def __call__(
EXAMPLE ::
>>> from estimator import *
>>> _ = NTRU.estimate(schemes.NTRUHPS2048509Enc)
usvp :: rop: ≈2^134.5, red: ≈2^134.5, δ: 1.004179, β: 373, d: 923, tag: usvp
bdd :: rop: ≈2^130.9, red: ≈2^129.9, svp: ≈2^129.9, β: 356, η: 389, d: 917, tag: bdd
bdd_hybrid :: rop: ≈2^130.9, red: ≈2^129.9, svp: ≈2^129.9, β: 356, η: 389, ζ: 0, |S|: 1, ...
bdd_mitm_hybrid :: rop: ≈2^185.3, red: ≈2^184.5, svp: ≈2^184.2, β: 371, η: 2, ζ: 159, |S|: ≈2^228.0...
>>> _ = NTRU.estimate(schemes.NTRUHRSS701Enc)
usvp :: rop: ≈2^162.1, red: ≈2^162.1, δ: 1.003557, β: 470, d: 1317, tag: usvp
bdd :: rop: ≈2^158.7, red: ≈2^157.7, svp: ≈2^157.7, β: 454, η: 489, d: 1306, tag: bdd
bdd_hybrid :: rop: ≈2^158.7, red: ≈2^157.7, svp: ≈2^157.7, β: 454, η: 489, ζ: 0, |S|: 1, d: ...
bdd_mitm_hybrid :: rop: ≈2^233.0, red: ≈2^232.1, svp: ≈2^232.0, β: 469, η: 2, ζ: 178, |S|: ...
>>> params = NTRU.Parameters(n=113, q=512, Xs=ND.UniformMod(3), Xe=ND.UniformMod(3))
>>> _ = NTRU.estimate(params)
>>> _ = NTRU.estimate(params, catch_exceptions=False)
usvp :: rop: ≈2^46.0, red: ≈2^46.0, δ: 1.011516, β: 59, d: 221, tag: usvp
dsd :: rop: ≈2^37.9, red: ≈2^37.9, δ: 1.013310, β: 31, d: 226, tag: dsd
bdd :: rop: ≈2^42.4, red: ≈2^41.0, svp: ≈2^41.8, β: 41, η: 70, d: 225, tag: bdd
Expand Down
7 changes: 3 additions & 4 deletions estimator/ntru_primal.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ def __call__(
EXAMPLE::
>>> from estimator import *
>>> NTRU.primal_dsd(schemes.NTRUHPS2048509Enc)
rop: ≈2^157.1, red: ≈2^157.1, δ: 1.003645, β: 453, d: 1016, tag: dsd
>>> NTRU.primal_dsd(schemes.NTRUHRSS701Enc)
rop: ≈2^190.2, red: ≈2^190.2, δ: 1.003095, β: 571, d: 1400, tag: dsd
>>> params = NTRU.Parameters(n=113, q=512, Xs=ND.UniformMod(3), Xe=ND.UniformMod(3))
>>> NTRU.primal_dsd(params, red_shape_model="zgsa")
Expand All @@ -201,8 +201,7 @@ def __call__(
discovery is 0) will return β = d.
"""
if params.Xs.stddev != params.Xe.stddev:
raise NotImplementedError("""Dense sublattice attack estimation currently unsupported for f and g with
different variances""")
raise NotImplementedError("Dense sublattice attack not supported for Xs != Xe")

params = NTRUParameters.normalize(params)
# allow for a larger embedding lattice dimension: Bai and Galbraith
Expand Down

0 comments on commit 4a1389f

Please sign in to comment.