A method of implementing a cryptographic operation as a white-box implementation using a specified substitution box, comprising: - selecting a substitution box; - specifying a set of functions V={(α,β)} for the selected substitution box S, the set comprising pairs (α,β) of input functions and output functions for the selected substitution box such that for all inputs x to the selected substitution box, S(x)=β∘S∘ α -1 (x) holds; - determining the minimum diversification number of the selected substitution box for the set of functions as the smallest of the diversification numbers D v (x) over each possible input x of the selected substitution box for the specified set of functions; - comparing the minimum diversification number to a threshold value; and - implementing the cryptographic operation using the selected substitution box as the specified substitution box when the minimum diversification number is greater or equal to a threshold value, wherein: said diversification number D v (x) indicates the number D v (x) = |{α -1 (x)| (α,β) ∈ V} for a given input x of the selected substitution box, and wherein the cryptographic operation comprises: - receiving input data; - selecting one pair (a,b) from the set of functions V based upon de input data having an associated identifier; - encoding the input data using the input function a; - securely communicating the associated identifier to a decoder decoding the output data; - inputting the encoded input data into the specified substitution box to obtain output data; and - decoding the output data using the output function b. - selecting a substitution box; - specifying a set of functions V={(α,β)} for the selected substitution box S, the set comprising pairs (α,β) of input functions and output functions for the selected substitution box such that for all inputs x to the selected substitution box, S(x)=β∘S∘ α -1 (x) holds; - determining the minimum diversification number of the selected substitution box for the set of functions as the smallest of the diversification numbers D v (x) over each possible input x of the selected substitution box for the specified set of functions; - comparing the minimum diversification number to a threshold value; and - implementing the cryptographic operation using the selected substitution box as the specified substitution box when the minimum diversification number is greater or equal to a threshold value, wherein: said diversification number D v (x) indicates the number D v (x) = |{α -1 (x)| (α,β) ∈ V} for a given input x of the selected substitution box, and wherein the cryptographic operation comprises: said diversification number D v (x) indicates the number D v (x) = |{α -1 (x)| (α,β) ∈ V} for a given input x of the selected substitution box, and wherein the cryptographic operation comprises: - receiving input data; - selecting one pair (a,b) from the set of functions V based upon de input data having an associated identifier; - encoding the input data using the input function a; - securely communicating the associated identifier to a decoder decoding the output data; - inputting the encoded input data into the specified substitution box to obtain output data; and - decoding the output data using the output function b.