QR code encryption and decryption method and system based on chaos theory and AES algorithm

By combining chaos theory and AES algorithm, a key sequence is generated for QR code encryption and decryption, the problems of information leakage and tampering in the existing technology are solved, and efficient data protection and security are achieved.

CN119094102AActive Publication Date: 2024-12-06SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD

Patent Information

Application Number
CN202411238789.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2024-12-06
Estimated Expiration
2044-09-05

AI Technical Summary

Technical Problem

The existing QR code encryption methods have the risk of information leakage or information tampering, especially in the process of information transmission, it is difficult to effectively protect data security.

Method used

The QR code encryption and decryption method based on chaos theory and AES algorithm is adopted to generate a key sequence through improved Logistic mapping and Chebyshev mapping, and combine AES encryption and decryption processes to ensure the security and integrity of the data.

Benefits of technology

It effectively reduces the information leakage or information tampering caused by QR code, improves the confidentiality and decoding complexity of data, and enhances the security and efficiency of encryption algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094102A_ABST
    Figure CN119094102A_ABST
Patent Text Reader

Abstract

The invention discloses a QR code encryption and decryption method and system based on a chaos theory and an AES algorithm, and relates to the technical field of QR code encryption and decryption, and the method comprises an encryption process and a decryption process. The encryption process comprises the following steps: firstly, performing XOR on chaotic sequences respectively generated by improved Logistic mapping and Chebyshev mapping to obtain a composite chaotic sequence, taking the composite chaotic sequence as an initial key of AES grouping, and further obtaining a ciphertext through AES encryption. Grouping initial secret keys are dynamically generated, newly generated secret keys are adopted for encrypting each group of plaintext data, and the secret keys are completely independent, so that one secret key at a time is realized. And then improving an AES algorithm, firstly encrypting plaintext information, then performing Base64 secondary encryption, and performing QR code standard coding on final ciphertext information to generate an encrypted QR code. According to the method, the encryption processing mode is added, so that the problem of information leakage or information tampering caused by the QR code is effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of QR code encryption and decryption, and in particular to a QR code encryption and decryption method and system based on chaos theory and AES algorithm. Background Art

[0002] QR Code (Quick Response Code) is an efficient two-dimensional barcode system developed by Denso Wave of Japan in 1994. It can be scanned and read quickly, hence the name "Quick Response". QR Code is designed to provide high-speed reading capability, large data capacity and powerful error correction function, so that it can perform well in various application scenarios.

[0003] The main components of a QR code:

[0004] 1. Functional graphics. Functional graphics include position detection graphics, separators, positioning graphics and correction graphics, etc. These elements help the decoder identify the direction, size and version of the QR code, and correct the distortion that may occur during scanning.

[0005] 2. Coding area. The coding area contains format information, version information, data and error correction codewords; the format information defines the level of error correction and the mask method used; the version information indicates the size and capacity of the QR code; the data and error correction codewords are the actual stored information and the codes used for error recovery.

[0006] The QR code encoding process is as follows:

[0007] (1) Data analysis and selection of coding mode: According to the type of input data (such as numeric, alphanumeric, binary, etc.), select the appropriate coding mode for conversion.

[0008] (2) Error correction coding: The Reed-Solomon error correction algorithm is used to generate error correction codewords to ensure that the original data can be recovered after a certain level of physical damage.

[0009] (3) Construct the final information: Arrange the data codewords and error correction codewords in a matrix and fill them as needed to ensure the integrity of the symbols.

[0010] (4) Applying masks and arranging modules: By applying masks, we ensure that the black and white modules in the QR code are evenly distributed to avoid scanner-unfriendly patterns.

[0011] (5) Add format and version information: Finally, add the format information and version information to the specified position in the QR code to complete the construction of the entire symbol.

[0012] The decoding process of the QR code is the reverse process of the encoding process, and the steps are as follows:

[0013] (1) Image recognition and module reading: The scanner first recognizes the image of the QR code and reads the dark and light modules to obtain the encoded information.

[0014] (2) Extracting format and version information: Extracting format information and version information from the QR code. This information is crucial for subsequent data analysis.

[0015] (3) Mask removal and error correction: Remove the masking effect and use error correction codewords to detect and correct possible errors.

[0016] (4) Data analysis: According to the initial coding mode, the data codewords are translated back to the original data form to achieve complete data recovery.

[0017] QR codes are widely used in many occasions around the world due to their efficiency and flexibility, such as product tracking, advertising, mobile payment and personal identity verification. With the popularity of smartphones and mobile devices, the use of QR codes has become more widespread, providing great convenience for people's daily life and work.

[0018] There are three commonly used QR code encryption methods:

[0019] The first method is to use an encryption algorithm to encrypt the plain text information first, and then use the QR code generation software to generate the encrypted cipher text information to generate a QR code. This method is easy to implement and can generate a relatively standard QR code. It can encrypt the QR code information without destroying the QR code image.

[0020] The second method is to encrypt the QR code image after it is generated, and use the image encryption method to encrypt the QR image, thereby indirectly realizing information encryption. This method has certain limitations. If the QR code image is encrypted using the image encryption algorithm, the encrypted image will be unpredictable and will no longer have the symbolic features of the QR code. Standard QR recognition devices cannot decode the information in it. This method greatly reduces the use value of the encrypted QR code to a certain extent and is only suitable for special scenarios.

[0021] The third method is to combine the coding principle and production process of QR code to conduct encryption research. The encryption position can be selected between information coding and error correction coding; integrated in the process of error correction coding; after error correction coding and before generating QR code image. Compared with the first two methods, the third method has the best encryption effect and the highest security, but it is also the most complicated to implement. Although it increases the difficulty of cracking, it also increases the complexity of decoding. Moreover, the deeper the encryption is, the more aspects need to be considered, and the higher the requirements for the encryption algorithm.

[0022] This paper considers designing a QR code encryption and decryption method and system based on chaos theory and AES algorithm, based on the first method and combined with chaotic mapping. Summary of the invention

[0023] In view of the needs and shortcomings of current technological development, the present invention provides a QR code encryption and decryption method and system based on chaos theory and AES algorithm, which can effectively reduce the information leakage or information tampering problems caused by QR codes by increasing the encryption processing mode.

[0024] In the first aspect, the present invention provides a QR code encryption and decryption method based on chaos theory and AES algorithm. The technical solution adopted to solve the above technical problems is as follows:

[0025] A QR code encryption and decryption method based on chaos theory and AES algorithm, which includes a QR code encryption process and a QR code decryption process;

[0026] (1) QR code encryption process

[0027] (1.1) Obtain the plaintext information to be generated for the QR code, and calculate the number of complete groups g containing 128 bits and the number of bytes r contained in the last incomplete group based on the total number of bytes of the plaintext information;

[0028] (1.2) The current system time is obtained as a random seed, and the pseudo-random generator generates initial parameters of the improved logistic map and Chebyshev map;

[0029] (1.3) According to the calculation result of step (1.1), the plaintext information is grouped to obtain g plaintext blocks containing 128 bits and one plaintext block containing less than 128 bits;

[0030] (1.4) Iterate the improved Logistic map and Chebyshev map respectively to remove the transient influence caused by the initial conditions of the chaotic system and realize the discretization of the chaotic sequence;

[0031] (1.5) Generate two 128-bit binary sequences by iterating the improved Logistic map and Chebyshev map and binarizing the results; obtain the 128-bit initial key sequence for AES encryption by XOR operation; repeat this process g+r times to obtain g+r 128-bit initial key sequences;

[0032] (1.6) Using the g+r 128-bit initial key sequences obtained in step (1.5), perform AES encryption on the g 128-bit plaintext blocks obtained in step (1.3) one by one to obtain the corresponding ciphertext blocks; for the 1 plaintext block less than 128 bits obtained in step (1.3), randomly intercept 8r bits from the g+r 128-bit initial key sequences, perform bit-by-bit XOR operation with the bytes contained in the plaintext block, and obtain the remaining ciphertext; merge the aforementioned ciphertext blocks one by one, and concatenate the remaining ciphertexts to obtain the ciphertext encrypted by the improved AES algorithm;

[0033] (1.7) Convert the ciphertext encrypted by the improved AES algorithm into Base64 encoding to obtain the final ciphertext information;

[0034] (1.8) Save the g+r 128-bit initial key sequences and the final ciphertext information in the database;

[0035] (1.9) Convert the final ciphertext information into a QR code to complete the entire encryption and encoding process;

[0036] (2) QR code decryption process

[0037] (2.1) Obtain g+r 128-bit initial key sequences and encrypted ciphertext information from the database;

[0038] (2.2) Decode the ciphertext information using Base64 and restore it to binary data;

[0039] (2.3) Decrypt each ciphertext block using the same AES algorithm and the corresponding initial key sequence as the encryption process to obtain the original plaintext block;

[0040] (2.4) For the last ciphertext block that is less than 128 bits, it is necessary to first randomly intercept 8r bits from the g+r 128-bit initial key sequence, and then perform a bit-by-bit XOR operation with the bytes contained in the ciphertext block to obtain the remaining plaintext;

[0041] (2.5) Merge all decrypted plaintext blocks to obtain the complete plaintext information.

[0042] Optionally, after executing step (1.1), after obtaining the plaintext information to generate the QR code, first select a character encoding method based on the type and content of the plaintext information, then convert the plaintext information into binary data according to the selected encoding method, and finally count the length of the converted data to obtain the total number of bytes of the plaintext information.

[0043] Optionally, execute step (1.2), the pseudo-random generator generates the initial parameter x0 of the improved logistic mapping and the initial parameter y0 of the Chebyshev mapping based on the current time of the system;

[0044] The improved Logistic map has the form x n+1 =1-μ*x n 2 , where n is a natural number and x n represents chaotic variable, -1 <x n <1, μ represents the control parameter, 1<μ≤2; the control parameter μ is set to 2, that is, the improved logistic mapping is in a full mapping chaotic state;

[0045] The Chebyshev map has the form y n+1 =cos(k*arccos(y n )), where n is a natural number and y n Represents chaotic variable, -1≤y n ≤1, k represents the control parameter. When the control parameter k takes an integer value and is not less than 2, the Chebyshev map enters a chaotic state, and its iterative values ​​are uniformly mapped to the interval [-1, 1].

[0046] Optionally, execute step (1.4), iterate the improved Logistic map 2000+g times, iterate the Chebyshev map 2000+r times, generate long chaotic sequences respectively, then set a threshold, compare the values ​​in the sequence with the set threshold, convert the values ​​in the sequence greater than the set threshold to 1, and convert the values ​​in the sequence less than or equal to the set threshold to 0, so as to obtain a binary chaotic sequence and realize the discretization of the chaotic sequence.

[0047] Optionally, when executing step (1.5), the improved Logistic map and Chebyshev map are iterated 128 times respectively, and the real-valued chaotic sequence obtained in each iteration is quantized into a binary sequence with a threshold of 0.5, thereby forming two 128-bit binary sequences.

[0048] In the second aspect, the present invention provides a QR code encryption and decryption system based on chaos theory and AES algorithm. The technical solution adopted to solve the above technical problems is as follows:

[0049] A QR code encryption and decryption system based on chaos theory and AES algorithm, which includes a QR code encryption part and a QR code decryption part;

[0050] The QR code encryption part includes the following modules:

[0051] The obtaining calculation module is used to obtain the plain text information to generate the QR code, and calculate the number of complete groups g containing 128 bits and the number of bytes r contained in the last incomplete group according to the total number of bytes of the plain text information;

[0052] A grouping module, used for grouping the plaintext information according to the calculation result of the calculation module to obtain g plaintext blocks containing 128 bits and one plaintext block less than 128 bits;

[0053] Obtaining an initialization module, which is used to obtain the current system time as a random seed and generate initial parameters of the improved logistic map and Chebyshev map using a pseudo-random generator;

[0054] Iteration module, used to iterate the improved Logistic map and Chebyshev map respectively, remove the transient influence caused by the initial conditions of the chaotic system, and realize the discretization of the chaotic sequence;

[0055] The key generation module is used to first generate two 128-bit binary sequences by iterating the improved Logistic map and Chebyshev map and binarizing the results, and then obtain a 128-bit initial key sequence for AES encryption through an exclusive OR operation;

[0056] A cyclic execution module, used for cyclically executing the key generation module g+r times to obtain g+r 128-bit initial key sequences;

[0057] The encryption module is used to use the g+r 128-bit initial key sequences obtained by the key generation module to perform AES encryption on the g 128-bit plaintext blocks obtained by the grouping module one by one to obtain corresponding ciphertext blocks; for a plaintext block less than 128 bits obtained by the grouping module, it is also used to randomly intercept 8r bits from the g+r 128-bit initial key sequences, perform bit-by-bit XOR operation with the bytes contained in the plaintext block, and obtain the remaining ciphertext;

[0058] A ciphertext merging module is used to merge the aforementioned ciphertext blocks one by one and connect the remaining ciphertexts to obtain ciphertexts encrypted by the improved AES algorithm;

[0059] The conversion encoding module is used to convert the ciphertext encrypted by the improved AES algorithm into Base64 encoding to obtain the final ciphertext information;

[0060] A storage module is used to store g+r 128-bit initial key sequences and final ciphertext information in a database in correspondence;

[0061] The ciphertext conversion module is used to convert the final ciphertext information into a QR code to complete the entire encryption and encoding process;

[0062] The QR code decryption part includes the following modules:

[0063] An information acquisition module is used to obtain g+r 128-bit initial key sequences and encrypted ciphertext information from a database;

[0064] The decoding module is used to perform Base64 decoding on the ciphertext information and restore it to binary data;

[0065] The decryption module is used to decrypt each ciphertext block using the same AES algorithm and the corresponding initial key sequence as the QR code encryption part to obtain the original plaintext block; for the last ciphertext block less than 128 bits, it is also used to randomly intercept 8r bits from the g+r 128-bit initial key sequence, perform a bit-by-bit XOR operation with the bytes contained in the ciphertext block, and obtain the remaining plaintext;

[0066] The merging decryption module is used to merge all the decrypted plaintext blocks to obtain complete plaintext information.

[0067] Optionally, after the acquisition and calculation module of the QR code encryption part obtains the plaintext information to generate the QR code, it first selects a character encoding method according to the type and content of the plaintext information, then converts the plaintext information into binary data according to the selected encoding method, and then counts the length of the converted data to obtain the total number of bytes of the plaintext information, and finally, based on the total number of bytes of the plaintext information, calculates the number of complete groups g containing 128 bits and the number of bytes r contained in the last incomplete group.

[0068] Optionally, the acquisition initialization module of the QR code encryption part obtains the current time of the system as a random seed, and uses a pseudo-random generator to generate initial parameters x0 of the improved logistic mapping and y0 of the Chebyshev mapping;

[0069] The improved Logistic map has the form x n+1 =1-μ*x n 2 , where n is a natural number and x n represents chaotic variable, -1 <x n <1, μ represents the control parameter, 1<μ≤2; the control parameter μ is set to 2, that is, the improved logistic mapping is in a full mapping chaotic state;

[0070] The Chebyshev map has the form y n+1 =cos(k*arccos(y n )), where n is a natural number and y n Represents chaotic variable, -1≤y n ≤1, k represents the control parameter. When the control parameter k takes an integer value and is not less than 2, the Chebyshev map enters a chaotic state, and its iterative values ​​are uniformly mapped to the interval [-1, 1].

[0071] Optionally, the iterative module of the QR code encryption part iterates the improved Logistic map 2000+g times and the Chebyshev map 2000+r times to generate long chaotic sequences respectively, and then sets a threshold, compares the values ​​in the sequence with the set threshold, converts the values ​​in the sequence greater than the set threshold to 1, and converts the values ​​in the sequence less than or equal to the set threshold to 0, thereby obtaining a binary chaotic sequence and realizing the discretization of the chaotic sequence.

[0072] Optionally, the key generation module of the QR code encryption part involved first iterates the improved Logistic map and Chebyshev map 128 times respectively, and quantizes the real-valued chaotic sequence obtained in each iteration into a binary sequence with a threshold of 0.5, thereby forming two 128-bit binary sequences, and then obtains a 128-bit initial key sequence for AES encryption through an XOR operation.

[0073] The QR code encryption and decryption method and system based on chaos theory and AES algorithm of the present invention have the following beneficial effects compared with the prior art:

[0074] The present invention adopts improved Logistic mapping, Chebyshev mapping and improved AES algorithm to perform encryption and decryption of QR codes, which can effectively reduce the problem of information leakage or information tampering caused by QR codes. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] Attached Figure 1 is a flow chart of an encryption method according to Embodiment 1 of the present invention;

[0076] Attached Figure 2 This is a module connection block diagram of the second embodiment of the present invention. DETAILED DESCRIPTION

[0077] In order to make the technical solution, the technical problem solved and the technical effect of the present invention more clearly understood, the technical solution of the present invention is clearly and completely described below in conjunction with specific embodiments.

[0078] Embodiment 1:

[0079] This embodiment proposes a QR code encryption and decryption method based on chaos theory and AES algorithm, which includes a QR code encryption process and a QR code decryption process.

[0080] (1) Combined with Figure 1 , QR code encryption process

[0081] (1.1) Obtain the plaintext information to be generated into the QR code, select a character encoding method according to the type and content of the plaintext information, then convert the plaintext information into binary data according to the selected encoding method, and finally count the length of the converted data to obtain the total number of bytes of the plaintext information;

[0082] According to the total number of bytes of the plaintext information, the number of complete groups g containing 128 bits and the number of bytes r contained in the last incomplete group are calculated.

[0083] (1.2) Get the current system time as the random seed, and use the pseudo-random generator to generate the initial parameters x0 of the improved logistic map and g0 of the Chebyshev map. Where:

[0084] The improved Logistic map has the form x n+1 =1-μ*x n 2 , where n is a natural number and x n represents chaotic variable, -1 <x n <1, μ represents the control parameter, 1<μ≤2; the control parameter μ is set to 2, that is, the improved logistic mapping is in a full mapping chaotic state;

[0085] The Chebyshev map has the form y n+1 =cos(k*arccos(y n )), where n is a natural number and y n Represents chaotic variable, -1≤y n ≤1, k represents the control parameter. When the control parameter k takes an integer value and is not less than 2, the Chebyshev map enters a chaotic state, and its iterative values ​​are uniformly mapped to the interval [-1, 1].

[0086] (1.3) According to the calculation result of step (1.1), the plaintext information is grouped to obtain g plaintext blocks containing 128 bits and 1 plaintext block containing less than 128 bits.

[0087] (1.4) The improved Logistic map is iterated 2000+g times, and the Chebyshev map is iterated 2000+r times to generate long chaotic sequences respectively. Then a threshold is set, and the values ​​in the sequence are compared with the set threshold. The values ​​in the sequence that are greater than the set threshold are converted to 1, and the values ​​in the sequence that are less than or equal to the set threshold are converted to 0, thereby obtaining a binary chaotic sequence and realizing the discretization of the chaotic sequence.

[0088] (1.5) The improved Logistic map and Chebyshev map are iterated 128 times respectively, and the real-valued chaotic sequence obtained in each iteration is quantized into a binary sequence with a threshold of 0.5, thereby forming two 128-bit binary sequences. ; The 128-bit initial key sequence for AES encryption is obtained through XOR operation; This process is repeated g+r times, and g+r 128-bit initial key sequences are obtained.

[0089] (1.6) Using the g+r 128-bit initial key sequences obtained in step (1.5), perform AES encryption on the g 128-bit plaintext blocks obtained in step (1.3) one by one to obtain the corresponding ciphertext blocks; for the 1 plaintext block less than 128 bits obtained in step (1.3), randomly intercept 8r bits from the g+r 128-bit initial key sequences, perform bit-by-bit XOR operation with the bytes contained in the plaintext block, and obtain the remaining ciphertext; merge the aforementioned ciphertext blocks one by one, and concatenate the remaining ciphertexts to obtain the ciphertext encrypted by the improved AES algorithm;

[0090] (1.7) Convert the ciphertext encrypted by the improved AES algorithm into Base64 encoding to obtain the final ciphertext information;

[0091] (1.8) Save the g+r 128-bit initial key sequences and the final ciphertext information in the database;

[0092] (1.9) Convert the final ciphertext information into a QR code to complete the entire encryption and encoding process.

[0093] (2) QR code decryption process

[0094] (2.1) Obtain g+r 128-bit initial key sequences and encrypted ciphertext information from the database;

[0095] (2.2) Decode the ciphertext information using Base64 and restore it to binary data;

[0096] (2.3) Decrypt each ciphertext block using the same AES algorithm and the corresponding initial key sequence as the encryption process to obtain the original plaintext block;

[0097] (2.4) For the last ciphertext block that is less than 128 bits, it is necessary to first randomly intercept 8r bits from the g+r 128-bit initial key sequence, and then perform a bit-by-bit XOR operation with the bytes contained in the ciphertext block to obtain the remaining plaintext;

[0098] (2.5) Merge all decrypted plaintext blocks to obtain the complete plaintext information.

[0099] Embodiment 2:

[0100] Combined with Figure 2,This embodiment proposes a QR code encryption and decryption system based on chaos theory and AES algorithm, which includes a QR code encryption part and a QR code decryption part.

[0101] The QR code encryption part includes the following modules:

[0102] The acquisition calculation module is used to obtain the plain text information to generate the QR code, select the character encoding method according to the type and content of the plain text information, convert the plain text information into binary data according to the selected encoding method, count the length of the converted data, and obtain the total number of bytes of the plain text information, so as to further calculate the number of complete groups g containing 128 bits and the number of bytes contained in the last incomplete group r;

[0103] A grouping module, used for grouping the plaintext information according to the calculation result of the calculation module to obtain g plaintext blocks containing 128 bits and one plaintext block less than 128 bits;

[0104] Get the initialization module, which is used to obtain the current time of the system as a random seed, and use the pseudo-random generator to generate the initial parameters x0 of the improved logistic map and the initial parameters y0 of the Chebyshev map; where: the improved Logistic map has the form x n+1 =1-μ*x n 2 , n is a natural number, x n represents chaotic variable, -1 <x n <1, μ represents the control parameter, 1<μ≤2; the control parameter μ is set to 2, that is, the improved logistic map is in a full mapping chaotic state; the Chebyshev map has the form y n+1 =cos(k*arccos(y n )), n is a natural number, y n Represents chaotic variable, -1≤y n ≤1, k represents the control parameter. When the control parameter k takes an integer value and is not less than 2, the Chebyshev map enters a chaotic state, and its iterative values ​​are uniformly mapped to the interval [-1, 1];

[0105] The iterative module is used to iterate the improved Logistic map 2000+g times and the Chebyshev map 2000+r times to generate long chaotic sequences respectively, and then set a threshold, compare the values ​​in the sequence with the set threshold, convert the values ​​in the sequence greater than the set threshold to 1, and convert the values ​​in the sequence less than or equal to the set threshold to 0, so as to obtain a binary chaotic sequence and realize the discretization of the chaotic sequence;

[0106] The key generation module is used to first iterate the improved Logistic map and Chebyshev map for 128 times respectively, quantize the real-valued chaotic sequence obtained in each iteration into a binary sequence with 0 as the threshold, thereby forming two 128-bit binary sequences, and then obtain a 128-bit initial key sequence for AES encryption through an XOR operation;

[0107] A cyclic execution module, used for cyclically executing the key generation module g+r times to obtain g+r 128-bit initial key sequences;

[0108] The encryption module is used to use the g+r 128-bit initial key sequences obtained by the key generation module to perform AES encryption on the g 128-bit plaintext blocks obtained by the grouping module one by one to obtain corresponding ciphertext blocks; for a plaintext block less than 128 bits obtained by the grouping module, it is also used to randomly intercept 8r bits from the g+r 128-bit initial key sequences, perform bit-by-bit XOR operation with the bytes contained in the plaintext block, and obtain the remaining ciphertext;

[0109] A ciphertext merging module is used to merge the aforementioned ciphertext blocks one by one and connect the remaining ciphertexts to obtain ciphertexts encrypted by the improved AES algorithm;

[0110] The conversion encoding module is used to convert the ciphertext encrypted by the improved AES algorithm into Base64 encoding to obtain the final ciphertext information;

[0111] A storage module is used to store g+r 128-bit initial key sequences and final ciphertext information in a database in correspondence;

[0112] The ciphertext conversion module is used to convert the final ciphertext information into a QR code to complete the entire encryption and encoding process.

[0113] The QR code decryption part includes the following modules:

[0114] An information acquisition module is used to obtain g+r 128-bit initial key sequences and encrypted ciphertext information from a database;

[0115] The decoding module is used to perform Base64 decoding on the ciphertext information and restore it to binary data;

[0116] The decryption module is used to decrypt each ciphertext block using the same AES algorithm and the corresponding initial key sequence as the QR code encryption part to obtain the original plaintext block; for the last ciphertext block less than 128 bits, it is also used to randomly intercept 8r bits from the g+r 128-bit initial key sequence, perform a bit-by-bit XOR operation with the bytes contained in the ciphertext block, and obtain the remaining plaintext;

[0117] The merging decryption module is used to merge all the decrypted plaintext blocks to obtain complete plaintext information.

[0118] Based on the method of the first embodiment and the system of the second embodiment, it is necessary to supplement:

[0119] The AES (Advanced Encryption Standard) algorithm is an iterative block cipher system. Every 16 bytes (128 bits) of plaintext data are divided into a group and mapped into a 4×4 matrix, called a state matrix.

[0120] The AES encryption process is determined by the round transformation function, which includes four modules: byte substitution, row shift, column confusion and round key addition. The following is a detailed introduction to the four modules of the round transformation function:

[0121] 1. Byte Replacement (SubBytes)

[0122] Byte replacement is the first step in the AES encryption process. It mainly uses a lookup table called an S-box to perform nonlinear replacement on each byte in the state matrix. The specific operation is: represent the byte in binary format (8 bits per byte); take the upper 4 bits of the byte as the row value (0-15) and the lower 4 bits as the column value (0-15); use this row and column value to find the corresponding element in the S-box and replace the original byte with the value of the element. The purpose of this step is to increase the nonlinear characteristics of the password, making the encryption process more difficult to crack.

[0123] 2. ShiftRows

[0124] The row shift operation circularly shifts each row of the state matrix to the left, and the number of bits shifted varies depending on the row:

[0125] The first row remains unchanged.

[0126] The second row is shifted left by 1 byte (8 bits).

[0127] The third line is shifted left 2 bytes (16 bits).

[0128] The fourth line is shifted left 3 bytes (24 bits).

[0129] This row shift operation increases the diffusion of data, causing data to mix between rows, increasing the complexity of encryption.

[0130] 3. Mix Columns

[0131] The column obfuscation operation is performed independently on each column of the state matrix, using the multiplication properties over the finite field GF(2^8) to replace each byte of each column with a linear combination of multiple bytes. This step enhances the association between data within the column and further improves the security of encryption.

[0132] 4. AddRoundKey

[0133] Round key addition is to perform bit-by-bit XOR operation on the state matrix and the round key obtained by expanding the initial key. This step ensures that even if the same plaintext block is input, the output ciphertext block will be different due to the change of the round key.

[0134] The encryption and decryption process of the AES algorithm:

[0135] The AES encryption process includes initial key expansion and subsequent multiple rounds of transformations, each of which includes the above four steps, but the column confusion step is omitted in the last round. The decryption process is the inverse of these operations, including inverse byte substitution, reverse row shift, reverse column confusion, and round key addition, but the order of round keys is reversed.

[0136] The main differences between the improved AES algorithm and the AES algorithm are encryption speed, storage space usage, and key generation methods. These improvements are intended to improve the efficiency and security of the algorithm and make it more suitable for specific application scenarios. The following describes the differences between the improved AES algorithm and the AES algorithm in detail:

[0137] Encryption speed: Although the AES algorithm is already very efficient, its performance still needs to be improved in resource-constrained environments, such as embedded systems or IoT devices. The improved AES algorithm reduces the computational complexity by optimizing the structure of the encryption and decryption round functions, thereby increasing the encryption and decryption speed; the improved AES algorithm also uses a lookup table (LUT) to replace complex multiplication operations, which not only speeds up the encryption and decryption process, but also helps to achieve higher throughput in hardware implementation.

[0138] Storage space usage: In the standard AES implementation, S-boxes and other data structures take up a certain amount of storage space. The improved AES algorithm reduces the storage space usage by 40% by redesigning these data structures. This is especially important for devices with limited storage resources; the improved algorithm also defines new tables to simplify multiple operations, further reducing the storage space requirements.

[0139] Key generation method: The improved AES algorithm uses a composite chaotic sequence to generate the initial key sequence, which increases the randomness and complexity of the key, thereby improving the security of the algorithm. This method uses the characteristics of chaos theory that are sensitive to initial conditions to ensure that each encryption uses an unpredictable key sequence.

[0140] Encryption working mode: The improved AES algorithm may adopt different working modes, such as CBC, CFB, OFB, CTR, etc., to adapt to different application scenarios and security requirements. These working modes each have their own advantages and disadvantages. For example, the CBC mode provides diffusion, while the CTR mode supports parallel processing. The improved AES algorithm can choose the appropriate working mode as needed.

[0141] Flexibility and adaptability: The design of the improved AES algorithm takes into account a variety of application scenarios and can flexibly adapt to different hardware and software environments. It can run efficiently on resource-constrained devices while maintaining high security to meet modern encryption requirements.

[0142] In short, through the improvement of the AES algorithm, we can achieve significant improvements in encryption speed, storage space usage, key generation, working mode selection, etc. These improvements make the improved AES algorithm perform better in specific application scenarios, especially in situations that require high efficiency and high security. The emergence of the improved AES algorithm not only improves the confidentiality and integrity of data, but also promotes the development and application of cryptography.

[0143] In summary, the use of a QR code encryption and decryption method and system based on chaos theory and AES algorithm of the present invention can effectively reduce the problem of information leakage or information tampering caused by QR codes.

[0144] The above specific examples are used to explain the principles and implementation methods of the present invention in detail. These examples are only used to help understand the core technical content of the present invention. Based on the above specific embodiments of the present invention, any improvements and modifications made by technicians in this technical field without departing from the principles of the present invention should fall within the scope of patent protection of the present invention.

Claims

1. A QR code encryption and decryption method based on chaos theory and AES algorithm, characterized in that: It includes a QR code encryption process and a QR code decryption process; (1) QR code encryption process (1.1) Obtain the plaintext information to be generated for the QR code, and calculate the number of complete groups g containing 128 bits and the number of bytes r contained in the last incomplete group based on the total number of bytes of the plaintext information; (1.2) The current system time is obtained as a random seed, and the pseudo-random generator generates initial parameters of the improved logistic map and Chebyshev map; (1.3) According to the calculation result of step (1.1), the plaintext information is grouped to obtain g plaintext blocks containing 128 bits and one plaintext block containing less than 128 bits; (1.4) Iterate the improved Logistic map and Chebyshev map respectively to remove the transient influence caused by the initial conditions of the chaotic system and realize the discretization of the chaotic sequence; (1.5) Generate two 128-bit binary sequences by iterating the improved Logistic map and Chebyshev map and binarizing the results; obtain the 128-bit initial key sequence for AES encryption by XOR operation; repeat this process g+r times to obtain g+r 128-bit initial key sequences; (1.6) Using the g+r 128-bit initial key sequences obtained in step (1.5), perform AES encryption on the g 128-bit plaintext blocks obtained in step (1.3) one by one to obtain the corresponding ciphertext blocks; for the 1 plaintext block less than 128 bits obtained in step (1.3), randomly intercept 8r bits from the g+r 128-bit initial key sequences, perform bit-by-bit XOR operation with the bytes contained in the plaintext block, and obtain the remaining ciphertext; merge the aforementioned ciphertext blocks one by one, and concatenate the remaining ciphertexts to obtain the ciphertext encrypted by the improved AES algorithm; (1.7) Convert the ciphertext encrypted by the improved AES algorithm into Base64 encoding to obtain the final ciphertext information; (1.8) Save the g+r 128-bit initial key sequences and the final ciphertext information in the database; (1.9) Convert the final ciphertext information into a QR code to complete the entire encryption and encoding process; (2) QR code decryption process (2.1) Obtain g+r 128-bit initial key sequences and encrypted ciphertext information from the database; (2.2) Decode the ciphertext information using Base64 and restore it to binary data; (2.3) Decrypt each ciphertext block using the same AES algorithm and the corresponding initial key sequence as the encryption process to obtain the original plaintext block; (2.4) For the last ciphertext block that is less than 128 bits, it is necessary to first randomly intercept 8r bits from the g+r 128-bit initial key sequence, and then perform a bit-by-bit XOR operation with the bytes contained in the ciphertext block to obtain the remaining plaintext; (2.5) Merge all decrypted plaintext blocks to obtain the complete plaintext information.

2. According to claim 1, a QR code encryption and decryption method based on chaos theory and AES algorithm is characterized in that: Execute step (1.1) to obtain the plaintext information to generate the QR code. First, select the character encoding method according to the type and content of the plaintext information. Then convert the plaintext information into binary data according to the selected encoding method. Finally, count the length of the converted data to obtain the total number of bytes of the plaintext information.

3. According to claim 1, a QR code encryption and decryption method based on chaos theory and AES algorithm is characterized in that: Execute step (1.2), the pseudo-random generator generates the initial parameters of the improved logistic mapping based on the current system time and the initial parameters of the Chebyshev map The improved Logistic map has the form in, belongs to natural numbers, represents the chaotic variable, represents the control parameter, 1<μ≤2; when the control parameter μ is set to 2, the improved logistic mapping is in a full mapping chaotic state; The Chebyshev map has the form in, belongs to natural numbers, represents the chaotic variable, k represents a control parameter. When the control parameter k takes an integer value and is not less than 2, the Chebyshev map enters a chaotic state, and its iterative value is uniformly mapped to the interval [-1, 1].

4. According to claim 1, a QR code encryption and decryption method based on chaos theory and AES algorithm is characterized in that: Execute step (1.4), iterate the improved Logistic map 2000+g times, and iterate the Chebyshev map 2000+r times, respectively, to generate long chaotic sequences, then set a threshold, compare the values ​​in the sequence with the set threshold, convert the values ​​in the sequence greater than the set threshold to 1, and convert the values ​​in the sequence less than or equal to the set threshold to 0, thereby obtaining a binary chaotic sequence and realizing the discretization of the chaotic sequence.

5. The QR code encryption and decryption method based on chaos theory and AES algorithm according to claim 1 is characterized in that: When executing step (1.5), the improved Logistic map and Chebyshev map are iterated 128 times respectively, and the real-valued chaotic sequence obtained in each iteration is quantized into a binary sequence with a threshold of 0.5, thereby forming two 128-bit binary sequences.

6. A QR code encryption and decryption system based on chaos theory and AES algorithm, characterized in that: It includes a QR code encryption part and a QR code decryption part; The QR code encryption part includes the following modules: The obtaining calculation module is used to obtain the plain text information to generate the QR code, and calculate the number of complete groups g containing 128 bits and the number of bytes r contained in the last incomplete group according to the total number of bytes of the plain text information; A grouping module, used for grouping the plaintext information according to the calculation result of the calculation module to obtain g plaintext blocks containing 128 bits and one plaintext block less than 128 bits; Obtaining an initialization module, which is used to obtain the current system time as a random seed and generate initial parameters of the improved logistic map and Chebyshev map using a pseudo-random generator; Iteration module, used to iterate the improved Logistic map and Chebyshev map respectively, remove the transient influence caused by the initial conditions of the chaotic system, and realize the discretization of the chaotic sequence; The key generation module is used to first generate two 128-bit binary sequences by iterating the improved Logistic map and Chebyshev map and binarizing the results, and then obtain a 128-bit initial key sequence for AES encryption through an exclusive OR operation; A cyclic execution module, used for cyclically executing the key generation module g+r times to obtain g+r 128-bit initial key sequences; The encryption module is used to use the g+r 128-bit initial key sequences obtained by the key generation module to perform AES encryption on the g 128-bit plaintext blocks obtained by the grouping module one by one to obtain corresponding ciphertext blocks; for a plaintext block less than 128 bits obtained by the grouping module, it is also used to randomly intercept 8r bits from the g+r 128-bit initial key sequences, perform bit-by-bit XOR operation with the bytes contained in the plaintext block, and obtain the remaining ciphertext; A ciphertext merging module is used to merge the aforementioned ciphertext blocks one by one and connect the remaining ciphertexts to obtain ciphertexts encrypted by the improved AES algorithm; The conversion encoding module is used to convert the ciphertext encrypted by the improved AES algorithm into Base64 encoding to obtain the final ciphertext information; A storage module is used to store g+r 128-bit initial key sequences and final ciphertext information in a database in correspondence; The ciphertext conversion module is used to convert the final ciphertext information into a QR code to complete the entire encryption and encoding process; The QR code decryption part includes the following modules: An information acquisition module is used to obtain g+r 128-bit initial key sequences and encrypted ciphertext information from a database; The decoding module is used to perform Base64 decoding on the ciphertext information and restore it to binary data; The decryption module is used to decrypt each ciphertext block using the same AES algorithm and the corresponding initial key sequence as the QR code encryption part to obtain the original plaintext block; for the last ciphertext block less than 128 bits, it is also used to randomly intercept 8r bits from the g+r 128-bit initial key sequence, perform a bit-by-bit XOR operation with the bytes contained in the ciphertext block, and obtain the remaining plaintext; The merging decryption module is used to merge all the plaintext blocks obtained by decryption to obtain complete plaintext information.

7. The QR code encryption and decryption system based on chaos theory and AES algorithm according to claim 6, characterized in that: After the acquisition and calculation module of the QR code encryption part acquires the plaintext information to generate the QR code, it first selects a character encoding method according to the type and content of the plaintext information, then converts the plaintext information into binary data according to the selected encoding method, and then counts the length of the converted data to obtain the total number of bytes of the plaintext information. Finally, based on the total number of bytes of the plaintext information, it calculates the number of complete groups g containing 128 bits and the number of bytes r contained in the last incomplete group.

8. The QR code encryption and decryption system based on chaos theory and AES algorithm according to claim 6, characterized in that: The acquisition initialization module of the QR code encryption part obtains the current system time as a random seed and uses a pseudo-random generator to generate the initial parameters of the improved logistic mapping and the initial parameters of the Chebyshev map The improved Logistic map has the form in, belongs to natural numbers, represents the chaotic variable, μ represents the control parameter, 1<μ≤2; when the control parameter μ is set to 2, the improved logistic mapping is in a full mapping chaotic state; The Chebyshev map has the form in, belongs to natural numbers, represents the chaotic variable, k represents a control parameter. When the control parameter k takes an integer value and is not less than 2, the Chebyshev map enters a chaotic state, and its iterative value is uniformly mapped to the interval [-1, 1].

9. The QR code encryption and decryption system based on chaos theory and AES algorithm according to claim 6, characterized in that: The iterative module of the QR code encryption part iterates the improved Logistic map 2000+g times and the Chebyshev map 2000+r times to generate long chaotic sequences respectively, and then sets a threshold, compares the values ​​in the sequence with the set threshold, converts the values ​​in the sequence greater than the set threshold into 1, and converts the values ​​in the sequence less than or equal to the set threshold into 0, thereby obtaining a binary chaotic sequence and realizing the discretization of the chaotic sequence.

10. A QR code encryption and decryption system based on chaos theory and AES algorithm according to claim 6, characterized in that: The key generation module of the QR code encryption part first iterates the improved Logistic map and Chebyshev map 128 times respectively, quantizes the real-valued chaotic sequence obtained in each iteration into a binary sequence with a threshold of 0.5, thereby forming two 128-bit binary sequences, and then obtains a 128-bit initial key sequence for AES encryption through an XOR operation.

Citation Information

Patent Citations

  • Information encryption method based on ghost imaging calculation and data container customization

    CN110351451A

  • Power battery traceability management code encryption method based on improved AES algorithm

    CN111262684A

  • NADO Cryptography with Key Generators

    US20200228315A1

Cited By

  • Chaotic block encryption method and system based on model random selection, and medium

    CN119544184A

  • Company information encryption method combined with chaotic public key encryption algorithm

    CN120034313A

  • Digital signal encryption method and system

    CN120165833A

  • PLC data encryption communication method based on chaotic system mobile key

    CN120433941A