Equivalence Algorithms

From Boolean
Revision as of 16:26, 20 November 2024 by Joakim (talk | contribs)
Jump to navigation Jump to search

The hierarchy of equivalences

Given two vectorial boolean functions there are various ways to define equivalence between and . We will study the algorithms for determining Linear, Affine, Extended Affine and CCZ equivalence between vectorial boolean functions.


Linear Equivalence

Given two vectorial boolean functions and we want to determine if there exist Linear permutations and such that .

The to and from algorithm

This algorithm was presented at eurocrypt 2003 [1]. This algorithm is mainly intended for when the boolean functions are permutation, and we will start by assuming and are permutations.

The idea of the algorithm is to go use information gathered about to deduce information about and the other way around. To see how this can work let's say we know some value of , lets say . We of course also know the value of at so lets say that . Then we know that . So we now know that must be equal to .

For the other way around let's say we know some value of , lets say . We know the value of at y, lets say . Then we know that so we see that . Since we know that we need , which must mean that .

So we now showed how we can deduce information knowing either a value of or . Now lets say we now the values of at a set of points. Since is linear we also know it's value at any linear combinations of these points so we can just assume that we know the values at at linear independent points, which means that we know the value of at points. If we now somehow gain value of a point of which is not in the span of the already known points then we can deduce the value of at new points using any linear combination of points including this new point. Then we can use all of these new points and try to deduce points of as explained before. We will now explain the complete algorithm before giving the psudocode.

Given two permutations we construct the linear permutations . The algorithm is a backtracking algorithm, and whenever we discover a contradiction we backtrack to the last guess. We first guess two values of . Since we now know two values of we can two values of , which means we can deduce a third value by linearity. Using this third value we can deduce a value of , if this value is not in the span of the already known values of we can deduce two more values of and use this to deduce values of and so on. If we ever run out of values before we have finished we will have to make additional guesses. If we ever encounter that a situation where we deduce a value of or , but we have already set them to be something else, we must backtrack to the last guess.

Here is the psudocode:

sage: from sage.crypto.boolean_function import BooleanFunction
sage: B.<x0, x1, x2, x3> = BooleanPolynomialRing(4)
sage: f = x0*x1*x2*x3 + x0*x2*x3 + x1*x2*x3 + x0*x1 + x0*x3 + x1*x2 + x3 + 1
sage: F = BooleanFunction(f)
sage: F.algebraic_degree()
4

Runtime

It can be hard to estimate the runtime of this algorithm as it is hard to know how many guesses we have to make. Initially we will have to make two guesses (or just 1 if the s-boxes do not map 0 to 0) to get the algorithm started. Assuming we do not have to make any more guesses the algorithm runs in time ( if the s-boxes do not map 0 to 0). This assumption seems to hold for random functions, but there are bad cases for example when the functions differ in very few points. In general it seems hard to prove any good runtime guarantee for this algorithm.

Affine Equivalence

Given vectorial boolean functions find affine permutations such that . We can also write this as . If then is linear equivalent with . So we can guess any affine constants and check whether or not is linear equivalent with using any linear equivalence algorithm. This will add a multiplicative factor of to the runtime, but will give us an affine equivalence algorithm.

The to and from algorithm (Affine)

We can adapt the To and from algorithm to the affine case and only add a multiplicative factor of to the runtime. Instead of comparing to for every possible we will instead find a representative function for for every and then a representative function for for every possible . We will then compare to see if any of these representative functions are equal.

The representative for a function is the lexicographic smallest linear equivalent function. To see why this work assume are affine equivalent with where and . Then the functions will be linear equivalent with . If we have found the minimal linear representative of then since is linear equivalent with it is also linear equivalent with so the minimal linear representative of is at least smaller than . Using this argument the other way around we get that their linear representatives have to be the same function.

To actually compute the minimal representative of a function we do the following. We want to construct , the minimal permutation which is linear equivalent with . We start by guessing the value of at the smallest element of . Let say .

EA equivalence

Given two boolean functions find two affine permutations and an affine transformation such that

Jacobian algorithm

[2]

The Jacobian

Given a vectorial boolean function, and any element the deriviative in direction is defined by . The Jacobian for a vectorial boolean function is defined as


References

  1. Biryukov, Alex, et al. "A toolbox for cryptanalysis: Linear and affine equivalence algorithms." Advances in Cryptology—EUROCRYPT 2003: International Conference on the Theory and Applications of Cryptographic Techniques, Warsaw, Poland, May 4–8, 2003 Proceedings 22. Springer Berlin Heidelberg, 2003.
  2. Canteaut, Anne, Alain Couvreur, and Léo Perrin. "Recovering or testing extended-affine equivalence." IEEE Transactions on Information Theory 68.9 (2022): 6187-6206.