mq_helper

cryptographic_estimators.MQEstimator.mq_helper.nmonomials_of_degree(d, n, q=None)

Returns the number of n-variables monomials of degree d.

Note

If q is provided, then it considers the monomials in a ring modulo the ideal generated by the field equations.

Parameters:
  • d (int) – The degree.

  • n (int) – The number of variables.

  • q (int, optional) – The order of the finite field.

Examples

>>> from cryptographic_estimators.MQEstimator.mq_helper import nmonomials_of_degree
>>> nmonomials_of_degree(d=2, n=10, q=2)
45
cryptographic_estimators.MQEstimator.mq_helper.nmonomials_up_to_degree(d, n, q=None)

Return the number of n-variables monomials up to degree d.

Note

If q is provided, then it considers the monomials in a ring modulo the ideal generated by the field equations.

Parameters:
  • d (int) – Degree.

  • n (int) – Number of variables.

  • q (int, optional) – Order of finite field.

Examples

>>> from cryptographic_estimators.MQEstimator.mq_helper import nmonomials_up_to_degree
>>> nmonomials_up_to_degree(d=2, n=10, q=2)
56
cryptographic_estimators.MQEstimator.mq_helper.sum_of_binomial_coefficients(n, l)

Calculates the sum of binomial coefficients from 0 to l for the given n.

Parameters:
  • n (int) – A non-negative integer.

  • l (int) – A non-negative integer.

Returns:

The sum of the binomial coefficients from 0 to l for the given n.

Return type:

int

Examples

>>> from cryptographic_estimators.MQEstimator.mq_helper import sum_of_binomial_coefficients
>>> sum_of_binomial_coefficients(5, 2)
16