The invention provides a self-anti-
S box construction method and
system based on m-sequence generation and
logic optimization, and belongs to the technical field of
cryptography and hardware security. The method comprises the following steps: firstly, constructing an n-level
linear feedback shift register according to a set
S box number n and a primitive polynomial, generating an m sequence in a non-all-zero initial state, and adding an all-zero state at the
tail; a self-reverse
S box lookup table is constructed through a symmetric mapping strategy, so that the ith element in the sequence and the element at the symmetric position form mapping, and the same S box is used for
encryption and decryption. Thirdly, the
lookup table serves as a
Boolean function truth table, is simplified into a simplest expression through a logic
minimization algorithm and is decomposed into a layered logic circuit; during actual
processing, N data blocks are converted into a
bit plane format from
block type storage, then parallel operation is carried out through a hierarchical circuit, and finally a result is transposed back to
block type storage. According to the method, the same S box hardware module can be reused in the
encryption and decryption process, and hardware resources are remarkably saved.