sboxU.ccz package

This module contains tools to test forms of equivalence that are particular cases of CCZ-equivalence, including CCZ-equivalence itself.

Subpackages

Submodules

sboxU.ccz.cython_functions module

sboxU.ccz.cython_functions.EA_mapping()

Assume that A and B are full-rank linear applications, and C another (maybe not-full rank) linear application. Given a function F, these can be used to define G as an extended affine equivalent function of F. This function helps expressing the relationship between F and G in terms of graph.

Parameters:
  • A – a F2AffineMap-able object corresponding to a full rank linear application.

  • B – a F2AffineMap-able object corresponding to a full rank linear application.

  • C – a F2AffineMap-able object.

Returns:

A F2AffineMap corresponding to the linear permutation that must be applied to the graph of a function F in order to obtain the graph of the function B*F*A + C.

class sboxU.ccz.cython_functions.WalshZeroesSpaces

Bases: object

get_bases()
get_mappings()
image_by()
init_mappings()
thickness_spectrum()
sboxU.ccz.cython_functions.affine_equivalences()
sboxU.ccz.cython_functions.are_affine_equivalent()
sboxU.ccz.cython_functions.are_ccz_equivalent()
sboxU.ccz.cython_functions.are_cczl_equivalent()
sboxU.ccz.cython_functions.are_ea_equivalent()
sboxU.ccz.cython_functions.are_el_equivalent()
sboxU.ccz.cython_functions.are_linear_equivalent()
sboxU.ccz.cython_functions.ccz_block_decomposition()

Decompose a 2n x 2n matrix (F2AffineMap) into the 4 corresponding n x n matrices (returned as F2AffineMap).

sboxU.ccz.cython_functions.ccz_equivalences()
sboxU.ccz.cython_functions.ccz_equivalent_function()

Applies a linear permutation to the graph of a function, and returns the function whose graph is the result. Assumes that the linear permutation is admissible. If not, returns an empty S-box.

Parameters:
  • s – an S_box-able object

  • L – a F2AffineMap-able object

Returns:

If L is indeed admissible for s, then returns an S_box instance corresponding to the function whose graph is the image of that of s by L. Otherwise, returns an empty S_box.

sboxU.ccz.cython_functions.cczl_equivalences()
sboxU.ccz.cython_functions.ea_equivalences()
sboxU.ccz.cython_functions.el_equivalences()
sboxU.ccz.cython_functions.enumerate_ea_classes()
sboxU.ccz.cython_functions.enumerate_permutations_in_ccz_class()
sboxU.ccz.cython_functions.equivalences_from_lat()

Computes all equivalence relations between two functions F, G, from their linear approximation tables (LAT).

single_non_trivial_answer (bool) : Determines whether the search should stop when at the first automorphism that is encountered. number_of_threads (int): The number of threads to use. By default, it is set to 8. equivalence_type (string): Determines the type of the searched automorphisms. If “linear”, search for all pairs of linear bijections (A, B) satisfying B o F o A = F. If “extended-search”, search for all (A, B, C) linear with A, B bijective satisfying B o F o A + C = F. If “ccz-linear”, search for all linear bijection A such that A(graph(F)) = graph(G).

Returns:

A list of pairs of F2AffineMaps corresponding to all pairs of linear bijections (A, B) satisfying B o F o A = F.

Return type:

list

sboxU.ccz.cython_functions.get_WalshZeroesSpaces()
sboxU.ccz.cython_functions.linear_equivalences()
sboxU.ccz.cython_functions.thickness_spectrum()

Computes the thickness spectrum of the S_boxable object s.

The thickness spectrum was introduced in [FFA:CanPer19] and is an extended-affine equivalence class invariant. Its computation requires the knowledge of the vector spaces of a specific dimension contained in the so-called Walsh zeroes of the function, meaning that this function relies on the vector space search algorithm from [AC:BonPerTia19].

Parameters:
  • s (-) – an S_boxable object.

  • spaces (-) – if the Walsh zeroes of s are already known, then it is possible to pass the corresponding WalshZeroesSpaces object as a facultative argument to avoid recomputing it.

Returns:

A Spectrum instance such where the entry with key k is the number of spaces of dimension s.get_input_length() contained in the Walsh zeroes of s that have an intersection with V that is of dimension k.

sboxU.ccz.cython_functions.up_to_constant_equivalences()
sboxU.ccz.cython_functions.verify_up_to_constant_equivalence()

Verify whether sbox1 and sbox2 are indeed equivalent given an affine mapping x mapsto Lx + a.

sboxU.ccz.equivalence_from_vq module

sboxU.ccz.equivalence_from_vq.are_ea_equivalent_from_vq(f, g)[source]

sboxU.ccz.equivalences_from_code module

sboxU.ccz.equivalences_from_code.are_ccz_equivalent_from_code(f, g)[source]
sboxU.ccz.equivalences_from_code.are_code_equivalent(f, g, equivalence='CCZ')[source]
sboxU.ccz.equivalences_from_code.are_ea_equivalent_from_code(f, g)[source]
sboxU.ccz.equivalences_from_code.ccz_matrix(lut)[source]
sboxU.ccz.equivalences_from_code.ea_matrix(lut)[source]

sboxU.ccz.tu_decompositions module

class sboxU.ccz.tu_decompositions.TUdecomposition(A=None, B=None, C=None, T=None, U=None, U_prime=None, m=None)[source]

Bases: object

Stores the TU_t decomposition of a function.

core()[source]
get_S_box()[source]

Returnis the lookup table of the permutation whose TU-decomposition is stored.

insert_after_T(alpha)[source]

Returns a new TUdecomposition that is functionally equivalent, but where the linear permutation alpha is applied on the t-bit branch on which the T block is a permutation after it is called.

insert_after_U(alpha)[source]

Returns a new TUdecomposition that is functionally equivalent, but where the linear permutation alpha is applied on the (m-t)-bit branch on which the U block is applied, after it is called.

insert_before_T(alpha)[source]

Returns a new TUdecomposition that is functionally equivalent, but where the linear permutation alpha is applied on the t-bit branch on which the T block is a permutation before it is called.

insert_before_U(alpha)[source]

Returns a new TUdecomposition that is functionally equivalent, but where the linear permutation alpha is applied on the (n-t)-bit branch on which the U block is a applied, before it is called.

twist()[source]
sboxU.ccz.tu_decompositions.get_tu_decompositions(s, walsh_zeroes=None)[source]
sboxU.ccz.tu_decompositions.swap_F2AffineMap(t, n, m)[source]
sboxU.ccz.tu_decompositions.thickness(basis, n)[source]
sboxU.ccz.tu_decompositions.tu_decomposition_from_space_basis(s, basis, n, m)[source]

Using the knowledge that v is a subspace of Z_s of dimension n, a TU-decomposition (as defined in [Perrin17]) of s is performed and the corresponding TUdecomposition instance is returned.