Ticket #14478: trac_14478_reviewer.patch

File trac_14478_reviewer.patch, 4.9 KB (added by mvngu, 10 years ago)
  • sage/crypto/lwe.py

    # HG changeset patch
    # User Minh Van Nguyen <mvngu.name@gmail.com>
    # Date 1367910153 25200
    # Node ID 58c5bacef9af4298568aafe8c7ba9b137b352c23
    # Parent  592b5f7e633754aa343bf00012a6942597e084b4
    trac #14478: reviewer patch
    
    diff --git a/sage/crypto/lwe.py b/sage/crypto/lwe.py
    a b  
    231231
    232232        INPUT:
    233233
    234         - ``n`` - number of coeficients to be sampled
     234        - ``n`` - number of coefficients to be sampled
    235235        - ``stddev`` - standard deviation
    236236        - ``precision`` - precision used for internal computations (default: ``53``)
    237237        - ``tailcut`` - cut the tail at ``tailcut`` standard deviations
     
    318318            UniformSampler(-2, 2)
    319319        """
    320320        if lower_bound > upper_bound:
    321             raise TypeError("lower bound must be <= than upper bound.")
     321            raise TypeError("lower bound must be <= upper bound.")
    322322        self.lower_bound = ZZ(lower_bound)
    323323        self.upper_bound = ZZ(upper_bound)
    324324
     
    348348
    349349class UniformPolynomialSampler(SageObject):
    350350    """
    351     uniform sampler for polynomials.
     351    Uniform sampler for polynomials.
    352352
    353353    EXAMPLE::
    354354
     
    367367
    368368        INPUT:
    369369
    370         - ``n`` - number of coeficients to be sampled
     370        - ``n`` - number of coefficients to be sampled
    371371        - ``lower_bound`` - integer
    372372        - ``upper_bound`` - integer
    373373
     
    380380        self.n = ZZ(n)
    381381        self.P = ZZ['x']
    382382        if lower_bound > upper_bound:
    383             raise TypeError("lower bound must be <= than upper bound.")
     383            raise TypeError("lower bound must be <= upper bound.")
    384384        self.lower_bound = ZZ(lower_bound)
    385385        self.upper_bound = ZZ(upper_bound)
    386386        self.D = UniformSampler(self.lower_bound, self.upper_bound)
     
    429429        - ``q`` - modulus typically > n (integer > 0)
    430430        - ``D`` - an error distribution such as an instance of
    431431          :class:`DiscreteGaussianSamplerRejection` or :class:`UniformSampler`
    432         - ``secret_dist`` - distribution of the secret; one of
     432        - ``secret_dist`` - distribution of the secret (default: 'uniform'); one of
    433433
    434434          - "uniform" - secret follows the uniform distribution in `\Zmod{q}`
    435           - "noise" - secret follows the noise distrbution
     435          - "noise" - secret follows the noise distribution
    436436          - ``(lb,ub)`` - the secret is chosen uniformly from ``[lb,...,ub]`` including both endpoints
    437437
    438438        - ``m`` - number of allowed samples or ``None`` if no such limit exists
     
    539539    """
    540540    def __init__(self, n, secret_dist='uniform', m=None):
    541541        """
    542         Construct LWE instance parameterised by security paramter ``n`` where
     542        Construct LWE instance parameterised by security parameter ``n`` where
    543543        the modulus ``q`` and the ``stddev`` of the noise are chosen as in
    544544        [Reg09]_.
    545545
    546546        INPUT:
    547547
    548         - ``n`` - security paramter (integer > 0)
     548        - ``n`` - security parameter (integer > 0)
    549549        - ``secret_dist`` - distribution of the secret. See documentation of :class:`LWE`
    550550          for details (default='uniform')
    551551        - ``m`` - number of allowed samples or ``None`` if no such limit exists
     
    570570    """
    571571    def __init__(self, n, delta=0.01, m=None):
    572572        """
    573         Construct LWE instance parameterised by security paramter ``n`` where
     573        Construct LWE instance parameterised by security parameter ``n`` where
    574574        the modulus ``q`` and the ``stddev`` of the noise is chosen as in
    575575        [LP11]_.
    576576
    577577        INPUT:
    578578
    579         - ``n`` - security paramter (integer > 0)
     579        - ``n`` - security parameter (integer > 0)
    580580        - ``delta`` - error probability per symbol (default: 0.01)
    581581        - ``m`` - number of allowed samples or ``None`` in which case ``m=2*n +
    582582          128`` as in [LP11]_ (default: ``None``)
     
    613613
    614614class UniformNoiseLWE(LWE):
    615615    """
    616     LWE oracle with uniform sectet with parameters as in [CGW13]_.
     616    LWE oracle with uniform secret with parameters as in [CGW13]_.
    617617
    618618    .. automethod:: __init__
    619619    """
    620620    def __init__(self, n, instance='key', m=None):
    621621        """
    622         Construct LWE instance parameterised by security paramter ``n`` where
     622        Construct LWE instance parameterised by security parameter ``n`` where
    623623        all other parameters are chosen as in [CGW13]_.
    624624
    625625        INPUT:
    626626
    627         - ``n`` - security paramter (integer >= 80)
     627        - ``n`` - security parameter (integer >= 89)
    628628        - ``instance`` - one of
    629629
    630630          - "key" - the LWE-instance that hides the secret key is generated
     
    929929
    930930def balance_sample(s, q=None):
    931931    r"""
    932     Given ``(a,c) = s`` return a tuple ``(a',c')`` where ``a'`` is a integer
     932    Given ``(a,c) = s`` return a tuple ``(a',c')`` where ``a'`` is an integer
    933933    vector with entries between -q//2 and q//2 and ``c`` is also within these
    934934    bounds.
    935935