Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ludopulles committed Sep 19, 2024
1 parent b5781ba commit 4611b3b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
4 changes: 3 additions & 1 deletion estimator/lwe_dual.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ def __call__(
EXAMPLES::
>>> import warnings # https://github.com/sagemath/sage/issues/35473
>>> warnings.filterwarnings("ignore", category=DeprecationWarning)
>>> from estimator import *
>>> from estimator.lwe_dual import dual_hybrid
>>> params = LWE.Parameters(n=1024, q = 2**32, Xs=ND.Uniform(0,1), Xe=ND.DiscreteGaussian(3.0))
Expand All @@ -378,7 +380,7 @@ def __call__(
>>> LWE.dual(params)
rop: ≈2^103.4, mem: ≈2^63.9, m: 904, β: 251, d: 1928, ↻: 1, tag: dual
>>> dual_hybrid(params)
rop: ≈2^92.1, mem: ≈2^78.2, m: 716, β: 170, d: 1464, ↻: 1989, ζ: 276, h1: 8, tag: dual_hybrid
rop: ≈2^91.6, mem: ≈2^77.2, m: 711, β: 168, d: 1456, ↻: ≈2^11.2, ζ: 279, h1: 8, tag: dual_hybrid
>>> dual_hybrid(params, mitm_optimization=True)
rop: ≈2^98.2, mem: ≈2^78.6, m: 728, k: 292, ↻: ≈2^18.7, β: 180, d: 1267, ζ: 485, h1: 17, tag: ...
Expand Down
2 changes: 1 addition & 1 deletion estimator/lwe_guess.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __call__(self, params, log_level=5, **kwds):
Compare::
>>> LWE.primal_hybrid(schemes.Kyber512.updated(Xs=ND.SparseTernary(512, 16)))
rop: ≈2^85.8, red: ≈2^84.8, svp: ≈2^84.8, β: 105, η: 2, ζ: 366, |S|: ≈2^85.1, d: 315, prob: ≈2^-23.4, ...
rop: ≈2^136.4, red: ≈2^136.3, svp: ≈2^131.1, β: 251, η: 2, ζ: 203, |S|: ≈2^152.6, d: 673, ...
"""
params = LWEParameters.normalize(params)
Expand Down
6 changes: 3 additions & 3 deletions estimator/lwe_primal.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,13 @@ def __call__(
rop: ≈2^97.3, red: ≈2^96.3, svp: ≈2^96.3, β: 170, η: 142, ζ: 203, |S|: ≈2^16.3, d: 574, ...
>>> LWE.primal_hybrid(schemes.Kyber512.updated(Xs=ND.SparseTernary(512, 16)), mitm = False, babai = True)
rop: ≈2^88.7, red: ≈2^88.0, svp: ≈2^87.2, β: 98, η: 2, ζ: 323, |S|: ≈2^39.7, d: 346, ...
rop: ≈2^102.4, red: ≈2^102.2, svp: ≈2^99.8, β: 216, η: 2, ζ: 203, |S|: ≈2^69.7, d: 632, prob: 0.002, ...
>>> LWE.primal_hybrid(schemes.Kyber512.updated(Xs=ND.SparseTernary(512, 16)), mitm = True, babai = False)
rop: ≈2^74.1, red: ≈2^73.7, svp: ≈2^71.9, β: 104, η: 16, ζ: 320, |S|: ≈2^77.1, d: 359, ...
rop: ≈2^90.6, red: ≈2^89.7, svp: ≈2^89.6, β: 173, η: 138, ζ: 203, |S|: ≈2^36.4, d: 578, prob: 0.002, ...
>>> LWE.primal_hybrid(schemes.Kyber512.updated(Xs=ND.SparseTernary(512, 16)), mitm = True, babai = True)
rop: ≈2^85.8, red: ≈2^84.8, svp: ≈2^84.8, β: 105, η: 2, ζ: 366, |S|: ≈2^85.1, d: 315, ...
rop: ≈2^136.4, red: ≈2^136.3, svp: ≈2^131.1, β: 251, η: 2, ζ: 203, |S|: ≈2^152.6, d: 673, ...
TESTS:
Expand Down
4 changes: 2 additions & 2 deletions estimator/nd.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ def __hash__(self):
EXAMPLE::
>>> from estimator import *
>>> hash(ND.Uniform(-10, 10)) == hash(("Uniform", 10, 10, None))
>>> hash(ND.Uniform(-10, 10)) == hash(("Uniform", (-10, 10), None))
True
"""
return hash(("Uniform", self.a, self.b, self.n))
return hash(("Uniform", self.bounds, self.n))

def support_size(self, fraction=1.0):
"""
Expand Down
6 changes: 3 additions & 3 deletions estimator/ntru_primal.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,15 +369,15 @@ def __call__(
>>> NTRU.primal_hybrid(schemes.NTRUHPS2048509Enc.updated(Xs=ND.SparseTernary(508,16)),
... mitm = False, babai = True)
rop: ≈2^88.0, red: ≈2^87.4, svp: ≈2^86.4, β: 98, η: 2, ζ: 318, |S|: ≈2^39.6, d: 328, prob: ≈2^-27.9, ...
rop: ≈2^101.6, red: ≈2^101.5, svp: ≈2^96.5, β: 205, η: 2, ζ: 197, |S|: ≈2^64.1, d: 596, prob: ≈2^-11.7, ...
>>> NTRU.primal_hybrid(schemes.NTRUHPS2048509Enc.updated(Xs=ND.SparseTernary(508,16)),
... mitm = True, babai = False)
rop: ≈2^80.1, red: ≈2^79.7, svp: ≈2^78.3, β: 170, η: 22, ζ: 254, |S|: ≈2^103.7, d: 495, prob: 0.708, ...
rop: ≈2^89.6, red: ≈2^88.9, svp: ≈2^88.2, β: 172, η: 135, ζ: 197, |S|: ≈2^36.1, d: 555, prob: 0.003, ...
>>> NTRU.primal_hybrid(schemes.NTRUHPS2048509Enc.updated(Xs=ND.SparseTernary(508,16)),
... mitm = True, babai = True)
rop: ≈2^85.1, red: ≈2^84.1, svp: ≈2^84.0, β: 105, η: 2, ζ: 363, |S|: ≈2^85.0, d: 294, prob: ≈2^-22.9, ...
rop: ≈2^134.5, red: ≈2^134.4, svp: ≈2^129.2, β: 248, η: 2, ζ: 197, |S|: ≈2^151.2, d: 645, ...
TESTS:
Expand Down
4 changes: 2 additions & 2 deletions estimator/reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ def __call__(self, beta, d, B=None):
>>> from sage.all import var, find_fit
>>> dim = [100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250]
>>> nodes = [39.0, 44.0, 49.0, 54.0, 60.0, 66.0, 72.0, 78.0, 84.0, 96.0, \
99.0, 105.0, 111.0, 120.0, 127.0, 134.0]
>>> nodes = [39.0, 44.0, 49.0, 54.0, 60.0, 66.0, 72.0, 78.0, 84.0, 96.0 ]
>>> nodes += [ 99.0, 105.0, 111.0, 120.0, 127.0, 134.0] # couldn't use \\ breaks stuff
>>> times = [c + log(200,2).n() for c in nodes]
>>> T = list(zip(dim, nodes))
>>> var("a,b,c,beta")
Expand Down
5 changes: 3 additions & 2 deletions estimator/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,9 @@ def batch_estimate(params, algorithm, jobs=1, log_level=0, catch_exceptions=True
>>> from estimator import LWE
>>> from estimator.schemes import Kyber512
>>> _ = batch_estimate(Kyber512, [LWE.primal_usvp, LWE.primal_bdd])
>>> _ = batch_estimate(Kyber512, [LWE.primal_usvp, LWE.primal_bdd], jobs=2)
>>> from estimator.util import batch_estimate
>>> _ = batch_estimate(Kyber512, [LWE.primal_usvp, LWE.primal_bdd], log_level=1)
>>> _ = batch_estimate(Kyber512, [LWE.primal_usvp, LWE.primal_bdd], jobs=2, log_level=1)
"""

Expand Down

0 comments on commit 4611b3b

Please sign in to comment.