sboxU.core.anf package
Algebraic normal form and related functions.
Submodules
sboxU.core.anf.cython_functions module
- sboxU.core.anf.cython_functions.algebraic_degree()
- sboxU.core.anf.cython_functions.algebraic_normal_form()
The algebraic normal form of a vectorial boolean function is the multivariate polynomial representation of the coordinates of this function.
- Parameters:
s – an S_box-able object
polynomial_vars – the variables used to express the polynomial.
- Returns:
A list of polynomials corresponding to the anfs of the coordinate functions of s, expressed in terms of polynomial_vars if not None.
- sboxU.core.anf.cython_functions.algebraic_normal_form_coordinate()
The algebraic normal form of a boolean function is the multivariate polynomial representation of this function.
- Parameters:
s – an S_box-able object of output length 1.
polynomial_vars – the variables used to express the polynomial.
- Returns:
A polynomial corresponding to the anf of the boolean function s, expressed in terms of polynomial_vars if not None.
- sboxU.core.anf.cython_functions.anf_component()
- sboxU.core.anf.cython_functions.degree_spectrum()
The degree spectrum describes the number of components of an S-box that have algebraic degree exactly k.
- Parameters:
s – an S_box-able object
- Returns:
A Spectrum object d such that d[k] is the number of components of s with algebraic degree exactly equal to k.
- sboxU.core.anf.cython_functions.eval_anf()
Evaluate a multivariate binary polynomial (in Algebraic Normal Form, ANF) at a given integer input. The polynomial is defined on n variables. The integer x is interpreted as an n-bit binary vector, where each bit corresponds to the value assigned to one variable of the polynomial.
- Parameters:
anf – a multivariate binary polynomial on n variables (in algebraic normal form).
x (int) – an integer between 0 and 2**n - 1. Its n-bit binary representation is used as the variable assignment for the polynomial.
- Returns:
The evaluation of the polynomial at the assignment given by x (always 0 or 1).
- sboxU.core.anf.cython_functions.eval_vect_anf()
Evaluate a vectorial Boolean function, represented as a list of multivariate binary polynomials (in Algebraic Normal Form, ANF), at a given integer input. Each polynomial in anfs corresponds to one output coordinate of the function. The integer x is interpreted as an n-bit binary vector, used as the variable assignment for all polynomials.
- Parameters:
anfs (list) – list of multivariate binary polynomials. All polynomials must have the same number of variables.
x (int) – an integer whose n-bit binary representation defines the input assignment for the polynomials.
- Returns:
the integer y representing the vector of polynomial evaluations, where bit i of y is the output of anfs[i](x).
- sboxU.core.anf.cython_functions.is_degree_bigger_than()
- Args :
s : an S_box-able object d : the degree bound we want to test
- Returns:
A boolean value, True if the algebraic degree of s is (strictly) bigger than d, False otherwise.
- sboxU.core.anf.cython_functions.quadratic_compact_representation()
- Parameters:
s – an S_box-able object
- Returns:
A list of elements representing a compact representation of a quadratic function
- sboxU.core.anf.cython_functions.quadratic_sbox_from_compact_representation()
- Parameters:
repr – a quadratic compact representation
n – input size
m – output size
- Returns:
The quadratic S box corresponding to the compact representation