# General form of ANF of degree d

I need to create a general form of ANF of degree d, so I could substitute values of x in it to find the actual ANF of the function.

I'm trying to write an algorithm that calculates algebraic immunity of the function of degree d.

- Substitute all N arguments x with f(x) = 1 in the ANF of a general boolean function g(x) of degree d. This gives a system of N linear equations for the coefficients of g(x).
- Solve this linear system.
- If there is no (nontrivial) solution, output no annihilator of degree d, else determine sets of coefficients for linearly independent annihilators.