The application discloses a color-coated product anti-counterfeiting
system and a double-layer
encryption and decryption method thereof, and specifically comprises the following steps: in the
encryption process, the first layer uses the SM4 national
encryption algorithm to encrypt
plaintext; the second layer derives a key based on the PBKDF2, and performs three rounds of
confusion encryption on the first layer
ciphertext, including character replacement and position replacement, to generate second layer
ciphertext; finally, a check code is generated based on the derived key, and the last character of the second layer
ciphertext is replaced to form the final ciphertext; in the decryption process, which is the reverse process of the encryption process, the same derived key is generated and the check code is verified, and the first layer ciphertext is obtained through reverse
confusion processing, and then the
plaintext is restored by using the SM4 decryption. The application constructs a double-layer
encryption system of the national encryption
algorithm and a self-defined
confusion structure, meets the national encryption regulation requirements, greatly improves the randomness and anti-
cracking ability of the anti-counterfeiting code through multiple rounds of confusion and
integrity check, effectively prevents data forgery and tampering, and the ciphertext length is suitable for two-dimensional code coding.