  Finding Boolean functions suitable for cryptographic primitives is a complex
combinatorial optimization problem, since they must satisfy several properties
to resist cryptanalytic attacks, and the space is very large, which grows super
exponentially with the number of input variables. Recent research has focused
on the study of Boolean functions that satisfy properties on restricted sets of
inputs due to their importance in the development of the FLIP stream cipher. In
this paper, we consider one such property, perfect balancedness, and
investigate the use of Genetic Programming (GP) and Genetic Algorithms (GA) to
construct Boolean functions that satisfy this property along with a good
nonlinearity profile. We formulate the related optimization problem and define
two encodings for the candidate solutions, namely the truth table and the
weightwise balanced representations. Somewhat surprisingly, the results show
that GA with the weightwise balanced representation outperforms GP with the
classical truth table phenotype in finding highly nonlinear WPB functions. This
finding is in stark contrast to previous findings on the evolution of globally
balanced Boolean functions, where GP always performs best.
