An encryption/decryption function generating method, wherein the method comprises: receiving a random seed and an original key that are input by a user; generating, according to the original key, a round key required for R-round iterative computing, wherein the round key required for R-round iterative computing comprises a round key of an r th round, R represents the number of rounds of iterative computing required for generating an encryption/decryption function, R is a positive integer, and 1 ≤ r ≤ R; generating, by using a random number generator and according to the random seed, an affine expansion mask required for the R-round iterative computing and random disturbance data required for the R-round iterative computing, wherein the affine expansion mask is used to affinely transform m-bit data into n-bit data, m and n are preset positive integers, n > m, the affine expansion mask is determined according to F(x) = A ∗ x + b, wherein x is an m-dimensional column vector, A and b are matrixes generated by using the random number generator and according to the random seed, A is an (n ∗ m)-sized full-column-rank matrix on binary field, b is an n-dimensional column vector, and F(x) can be determined according to A and b, the affine expansion mask required for the R-round iterative computing comprises an affine expansion mask of the r th round, and the random disturbance data required for the R-round iterative computing comprises random disturbance data of the r th round; and generating the encryption/decryption function, wherein the encryption/decryption function comprises a pre-computation table for the R-round iterative computing, a pre-computation table of the r th round in the pre-computation table for the R-round iterative computing comprises a one-to-one mapping relationship between preset input data of the r th round and output data corresponding to the input data, the preset input data of the r th round comprises preset input mask data of the r th round, the output data comprises output mask data of the r th round and the random disturbance data of the r th round, and the output mask data of the r th round is calculated according to a preset initial value, the round key of the r th round, and the affine expansion mask of the r th round; wherein each round of iterative computing includes multiple pre-computation tables of a minimum unit, the affine transformation of the output affine expansion mask is performed during the process of generating each pre-computation table of a minimum unit, the pre-computation table of a minimum unit includes 2 n records, the n-bit mask data corresponding to the m-bit data occupies 2 m records, and the remaining (2 n -2 m) records in the pre-computation table of each minimum unit are filled with the random disturbance data. receiving a random seed and an original key that are input by a user; generating, according to the original key, a round key required for R-round iterative computing, wherein the round key required for R-round iterative computing comprises a round key of an r th round, R represents the number of rounds of iterative computing required for generating an encryption/decryption function, R is a positive integer, and 1 ≤ r ≤ R; generating, by using a random number generator and according to the random seed, an affine expansion mask required for the R-round iterative computing and random disturbance data required for the R-round iterative computing, wherein the affine expansion mask is used to affinely transform m-bit data into n-bit data, m and n are preset positive integers, n > m, the affine expansion mask is determined according to F(x) = A ∗ x + b, wherein x is an m-dimensional column vector, A and b are matrixes generated by using the random number generator and according to the random seed, A is an (n ∗ m)-sized full-column-rank matrix on binary field, b is an n-dimensional column vector, and F(x) can be determined according to A and b, the affine expansion mask required for the R-round iterative computing comprises an affine expansion mask of the r th round, and the random disturbance data required for the R-round iterative computing comprises random disturbance data of the r th round; and generating the encryption/decryption function, wherein the encryption/decryption function comprises a pre-computation table for the R-round iterative computing, a pre-computation table of the r th round in the pre-computation table for the R-round iterative computing comprises a one-to-one mapping relationship between preset input data of the r th round and output data corresponding to the input data, the preset input data of the r th round comprises preset input mask data of the r th round, the output data comprises output mask data of the r th round and the random disturbance data of the r th round, and the output mask data of the r th round is calculated according to a preset initial value, the round key of the r th round, and the affine expansion mask of the r th round; wherein each round of iterative computing includes multiple pre-computation tables of a minimum unit, the affine transformation of the output affine expansion mask is performed during the process of generating each pre-computation table of a minimum unit, the pre-computation table of a minimum unit includes 2 n records, the n-bit mask data corresponding to the m-bit data occupies 2 m records, and the remaining (2 n -2 m) records in the pre-computation table of each minimum unit are filled with the random disturbance data.