diff --git a/estimator/lwe.py b/estimator/lwe.py index a1020be..d0ebce4 100644 --- a/estimator/lwe.py +++ b/estimator/lwe.py @@ -9,7 +9,8 @@ from .lwe_primal import primal_usvp, primal_bdd, primal_hybrid from .lwe_bkw import coded_bkw from .lwe_guess import exhaustive_search, mitm, distinguish, guess_composition # noqa -from .lwe_dual import dual, matzov +from .lwe_dual import dual +from .lwe_dual import matzov as dual_hybrid from .gb import arora_gb # noqa from .lwe_parameters import LWEParameters as Parameters # noqa from .conf import ( @@ -53,7 +54,7 @@ def rough(self, params, jobs=1, catch_exceptions=True): algorithms = {} algorithms["usvp"] = partial(primal_usvp, red_cost_model=RC.ADPS16, red_shape_model="gsa") - algorithms["dual_hybrid"] = partial(matzov, red_cost_model=RC.ADPS16) + algorithms["dual_hybrid"] = partial(dual_hybrid, red_cost_model=RC.ADPS16) if params.m > params.n**2 and params.Xe.is_bounded: if params.Xs.is_sparse: @@ -142,7 +143,7 @@ def __call__( red_shape_model=red_shape_model, ) algorithms["dual"] = partial(dual, red_cost_model=red_cost_model) - algorithms["dual_hybrid"] = partial(matzov, red_cost_model=red_cost_model) + algorithms["dual_hybrid"] = partial(dual_hybrid, red_cost_model=red_cost_model) algorithms = {k: v for k, v in algorithms.items() if k not in deny_list} algorithms.update(add_list) diff --git a/estimator/lwe_dual.py b/estimator/lwe_dual.py index 810ebde..bf8a0e5 100644 --- a/estimator/lwe_dual.py +++ b/estimator/lwe_dual.py @@ -366,47 +366,48 @@ def __call__( EXAMPLES:: >>> 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)) >>> LWE.dual(params) rop: ≈2^107.0, mem: ≈2^66.4, m: 970, β: 264, d: 1994, ↻: 1, tag: dual - >>> LWE.dual_hybrid(params) + >>> dual_hybrid(params) rop: ≈2^103.2, mem: ≈2^97.4, m: 937, β: 250, d: 1919, ↻: 1, ζ: 42, tag: dual_hybrid - >>> LWE.dual_hybrid(params, mitm_optimization=True) + >>> dual_hybrid(params, mitm_optimization=True) rop: ≈2^130.1, mem: ≈2^127.0, m: 1144, k: 120, ↻: 1, β: 347, d: 2024, ζ: 144, tag: dual_mitm_hybrid - >>> LWE.dual_hybrid(params, mitm_optimization="numerical") + >>> dual_hybrid(params, mitm_optimization="numerical") rop: ≈2^129.0, m: 1145, k: 1, mem: ≈2^131.0, ↻: 1, β: 346, d: 2044, ζ: 125, tag: dual_mitm_hybrid >>> params = params.updated(Xs=ND.SparseTernary(params.n, 32)) >>> LWE.dual(params) rop: ≈2^103.4, mem: ≈2^63.9, m: 904, β: 251, d: 1928, ↻: 1, tag: dual - >>> LWE.dual_hybrid(params) + >>> dual_hybrid(params) rop: ≈2^92.1, mem: ≈2^78.2, m: 716, β: 170, d: 1464, ↻: 1989, ζ: 276, h1: 8, tag: dual_hybrid - >>> LWE.dual_hybrid(params, mitm_optimization=True) + >>> 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: ... >>> params = params.updated(Xs=ND.CenteredBinomial(8)) >>> LWE.dual(params) rop: ≈2^114.5, mem: ≈2^71.8, m: 1103, β: 291, d: 2127, ↻: 1, tag: dual - >>> LWE.dual_hybrid(params) + >>> dual_hybrid(params) rop: ≈2^113.6, mem: ≈2^103.5, m: 1096, β: 288, d: 2110, ↻: 1, ζ: 10, tag: dual_hybrid - >>> LWE.dual_hybrid(params, mitm_optimization=True) + >>> dual_hybrid(params, mitm_optimization=True) rop: ≈2^155.5, mem: ≈2^146.2, m: 1414, k: 34, ↻: 1, β: 438, d: 2404, ζ: 34, tag: dual_mitm_hybrid >>> params = params.updated(Xs=ND.DiscreteGaussian(3.0)) >>> LWE.dual(params) rop: ≈2^116.5, mem: ≈2^73.2, m: 1140, β: 298, d: 2164, ↻: 1, tag: dual - >>> LWE.dual_hybrid(params) + >>> dual_hybrid(params) rop: ≈2^116.2, mem: ≈2^100.4, m: 1137, β: 297, d: 2155, ↻: 1, ζ: 6, tag: dual_hybrid - >>> LWE.dual_hybrid(params, mitm_optimization=True) + >>> dual_hybrid(params, mitm_optimization=True) rop: ≈2^160.7, mem: ≈2^156.8, m: 1473, k: 25, ↻: 1, β: 456, d: 2472, ζ: 25, tag: dual_mitm_hybrid - >>> LWE.dual_hybrid(schemes.NTRUHPS2048509Enc) + >>> dual_hybrid(schemes.NTRUHPS2048509Enc) rop: ≈2^131.7, mem: ≈2^128.5, m: 436, β: 358, d: 906, ↻: 1, ζ: 38, tag: dual_hybrid >>> LWE.dual(schemes.CHHS_4096_67) rop: ≈2^206.9, mem: ≈2^137.5, m: ≈2^11.8, β: 616, d: 7779, ↻: 1, tag: dual - >>> LWE.dual_hybrid(schemes.Kyber512, red_cost_model=RC.GJ21, fft=True) + >>> dual_hybrid(schemes.Kyber512, red_cost_model=RC.GJ21, fft=True) rop: ≈2^149.8, mem: ≈2^92.1, m: 510, t: 76, β: 399, d: 1000, ↻: 1, ζ: 22, tag: dual_hybrid """