The invention provides a data
encryption method and a related device, and is applied to the technical field of communication, and the data
encryption method comprises the steps: obtaining a
timestamp and a first equipment identifier of a target electronic student identity card under the condition of receiving
plaintext data, obtaining a second device identifier of a super
subscriber identity module SIM card bound with the target electronic student identity card; generating N first keys based on the
timestamp, the first device identifier and the second device identifier, N being an integer greater than 1; generating a dynamic
S box based on the second device identifier and the
timestamp; and performing N rounds of
encryption on the
plaintext data based on the N first keys and the dynamic
S box to obtain
ciphertext data. In the method, a first secret key and a dynamic
S box are determined through a first device identifier, a second device identifier and a timestamp, and then the dynamic S box and the first secret key are utilized to perform multi-round encryption on
plaintext data, so that the plaintext data are fully mixed and diffused, and the encryption capability for the data can be improved.