A method and
system for protecting an arbitrary
Boolean function of arbitrary number of variables, N, including in a computing device, if N=1, protecting one or more definitions of the arbitrary
Boolean function by applying a predetermined masking
algorithm, if N>1, reiteratively defining the arbitrary
Boolean function of number of variables, N, in terms of intermediate functions, G and H, of a fewer number of variables, N−M, where M<N, until N−M=1, applying the predetermined masking
algorithm for to the two or more intermediate functions, G and H, and combining the masked intermediate functions G and H according to a predetermined scheme to generate a masked arbitrary Boolean function of the number of variables, N. A method and
system for protecting an arbitrary Boolean function, F, for an arbitrary number of variables, N, from side-channel attacks, including in a computing device, if N=1, protecting one or more definitions of the arbitrary Boolean function by applying a predetermined masking
algorithm, and if N>1, defining the arbitrary Boolean function, F of the number of variables, N, in terms of two or more
single variable functions, G and H, applying the predetermined masking algorithm for N=1 to the two or more intermediate functions, G and H, and combining the masked intermediate functions G and H according to a predetermined scheme to generate a masked arbitrary Boolean function for the number of variables, N. Other embodiments are described and claimed