Diffusion-scrambling-diffusion image encryption method and system
By employing a diffusion-scrambling-diffusion image encryption method, a key value is generated using a hash function and a lightweight two-dimensional chaotic mapping. Combined with Josephus rings and Latin squares, dynamic rearrangement and global diffusion of image blocks are performed. This solves the problems of insufficient reversibility and resistance to statistical analysis in existing image encryption technologies, achieving efficient and secure image encryption.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- UNIV OF ELECTRONICS SCI & TECH OF CHINA ZHONGSHAN INST
- Filing Date
- 2025-12-01
- Publication Date
- 2026-04-21
AI Technical Summary
Existing image encryption methods are difficult to reversibly restore, have weak resistance to statistical analysis, insufficient diffusion depth, limited perturbation capabilities, and cannot effectively resist known plaintext attacks, resulting in low overall security.
An image encryption method of diffusion-scrambling-diffusion is adopted. The key value is generated by hash function and chaotic sequence is generated by lightweight two-dimensional chaotic mapping 2D-SQPM. The forward and backward cyclic shift of image blocks, dynamic rearrangement of Josephus ring, and rearrangement of Latin square positions are performed. Global XOR diffusion and DNA encoding and base XOR operation are also performed.
It achieves strong image reversibility, strong resistance to statistical analysis, lightweight and efficient security, can completely restore images without loss of information, has good practicality and engineering deployability, and enhances the ability to resist known plaintext attacks and security robustness.
Smart Images

Figure CN121217875B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image encryption technology, and in particular to an image encryption method and system of diffusion-scrambling-diffusion. Background Technology
[0002] With the development of cloud computing and mobile devices, more and more individuals and businesses are relying on the cloud for data storage and management. Whether it's sharing data in remote work or uploading photos, screenshots, scans, and other image data via mobile phones in daily life, people are increasingly inclined to store data directly in the cloud. On the one hand, cloud storage offers greater capacity and more flexible access methods, facilitating quick retrieval and synchronization across different devices and locations; however, on the other hand, once data leaves local control, it may face security risks such as privacy leaks, unauthorized access, and data tampering. This is especially true when uploading image files, which are not only large in size but often uploaded in batches of multiple images. Traditional encryption methods often face challenges such as low processing efficiency, high resource consumption, and heavy server load in such cases.
[0003] Currently, several solutions have been proposed for privacy protection and digital image encryption in cloud storage. One existing solution involves a multi-image encryption and sharing system based on a novel chaotic mapping. This system employs a revocable identity-based broadcast proxy re-encryption mechanism, combined with sinusoidal coupled quadratic chaotic mapping and bit-level permutation and disordered diffusion strategies to encrypt images, enhancing the randomness of the chaotic sequence and its ability to disrupt the original image structure. This solution improves security and the randomness of image encryption in the cloud environment to some extent. Another technical solution addresses the storage security of medical images in the cloud environment by designing an image encryption mechanism based on a combination of blockchain and chaotic encryption. This solution utilizes the Arnold cat mapping and Henon mapping to perform pixel-level permutation and diffusion on images, and stores the image signature document on the blockchain to verify the authenticity of the encrypted image. Through the decentralized and consensus mechanism of the blockchain, users can verify the integrity of the image after decryption, effectively preventing image tampering and forgery. In addition, researchers have proposed an image encryption algorithm based on an improved chaotic mapping. This scheme designs a sinusoidal oblique tent chaotic mapping, combines a perturbation mechanism to enhance the nonlinear characteristics of the chaotic system, and adopts a two-round pixel permutation and diffusion structure in the encryption process, which effectively improves the anti-attack capability and confidentiality of image data in the cloud environment.
[0004] Existing technologies have made some progress in protecting image data privacy, effectively enhancing the security and adaptability of image encryption schemes through the design of more complex chaotic mapping and pixel perturbation mechanisms. However, further exploration is needed to develop image encryption mechanisms with higher security, stronger revocability, and better computational efficiency to adapt to the growing demands of cloud data processing and sharing. Specifically, the shortcomings of existing technologies include:
[0005] 1. Difficulty in achieving reversible restoration. Many encryption methods do not fully consider the reversibility of the encryption process in their design, resulting in some schemes being unable to accurately restore the original image without losing information, thus limiting their applicability in application scenarios with high restoration accuracy requirements.
[0006] 2. Weak resistance to statistical analysis. Existing methods often use fixed initial values or user-preset keys, which are not fully coupled with the image content. This results in limited key space and low sensitivity to initial parameters, making it difficult to effectively resist chosen-plaintext or known-plaintext attacks. Furthermore, the grayscale distribution of the ciphertext image may retain some statistical features, increasing the risk of attackers using probability and statistics to crack the image.
[0007] 3. Insufficient diffusion depth and limited perturbation capability. Most existing methods adopt the classic "scramble-diffusion" structure proposed by Fridrich, which only performs one round of scrambling and one round of diffusion. This makes it difficult for local pixel perturbations to spread globally, and the encrypted image is not sensitive to changes in plaintext, resulting in low overall security.
[0008] Therefore, a safe, reliable, and lightweight image privacy protection scheme has significant research value and practical implications. Summary of the Invention
[0009] To address the technical problems existing in the prior art, this invention proposes a diffusion-scrambling-diffusion image encryption method and system, which realizes spatial deconstruction and rearrangement of image pixels.
[0010] On the one hand, to achieve the above objectives, the present invention provides a diffusion-scrambling-diffusion image encryption method, comprising:
[0011] The original image is input into a hash function to generate a hash value. A hash vector is constructed using the hash value. After mapping, several key values are generated. The initial parameters of the chaotic system are calculated based on the key values to generate a chaotic sequence.
[0012] The original image is zero-padded and divided into several non-overlapping image blocks of the same size. Each image block is then subjected to a forward and reverse bidirectional cyclic shift operation to obtain the first encrypted image after diffusion.
[0013] The starting position and jump step size of the Josephus ring are generated based on the chaotic sequence. The pixels in each image block of the first encrypted image are dynamically rearranged to obtain the second encrypted image.
[0014] The second encrypted image is divided into image blocks, a Latin square matrix is constructed using a chaotic sequence, and the row and column positions of the image blocks are rearranged to obtain the third encrypted image.
[0015] The third encrypted image is subjected to global XOR diffusion, DNA encoding, base XOR operation and DNA decoding operation to output the final encrypted image.
[0016] Preferably, the chaotic sequence is generated using a lightweight two-dimensional chaotic map 2D-SQPM, specifically as follows:
[0017] ;
[0018] In the formula, , All of these are control parameters. Let be the next state independent variable based on the value generated at the i-th pixel in the 2D-SQPM chaotic mapping. Let be the independent variable corresponding to the i-th pixel generated by the 2D-SQPM chaotic mapping. Let be the dependent variable corresponding to the i-th pixel generated by the 2D-SQPM chaotic mapping. Let be the next state dependent variable of the 2D-SQPM chaotic mapping, based on the value generated at the i-th pixel.
[0019] Preferably, a bidirectional cyclic shift operation is performed on each image block, including:
[0020] Each image block is flattened into a one-dimensional vector of uniform length. An initial diffusion offset is generated based on the chaotic sequence. A cyclic self-displacement operation is performed using the initial diffusion offset, followed by a forward cyclic left shift and a reverse cyclic right shift operation to obtain the first encrypted image.
[0021] Preferably, the cyclic self-displacement operation is performed using the initial diffusion offset, specifically as follows:
[0022] ;
[0023] In the formula, R is the initial diffusion offset, and K1 is the first pseudo-random sequence obtained by amplifying and quantizing the y variable sequence generated by the 2D-SQPM during the iteration process, accumulating it, and taking the modulus of 255. This is the offset of the next state in the cyclic self-displacement diffusion operation.
[0024] Preferably, generating the starting position and jump step size of the Josephus ring based on the chaotic sequence includes:
[0025] The pixels within the image block are converted into a one-dimensional array. The starting position and jump step size are generated based on the chaotic sequence. All pixel positions are traversed through the Josephus cycle rule to generate an access sequence and rearrange the pixels.
[0026] Preferably, when traversing all pixel positions using the Josephus ring rule, the update rule for the current position in each round of access is as follows:
[0027] ;
[0028] In the formula, This indicates the new position index to be reached in the next jump, pos indicates the starting position index of the current jump round, and len(index) indicates the length of the current index list. The fourth pseudo-random sequence is obtained by amplifying the x-variable sequence generated during the iteration process of the 2D-SQPM chaotic map by 64 times, rounding it down, and adding one.
[0029] Preferably, obtaining the third encrypted image includes:
[0030] The image blocks in the second encrypted image are grouped according to a preset size to form several image patching regions;
[0031] The row and column Latin squares are constructed using chaotic sequences, and the odd and even blocks in the image splicing area are perturbed by the column position mapping. After the perturbation is completed, all sub-block groups are spliced again to obtain the third encrypted image.
[0032] Preferably, the third encrypted image undergoes global XOR diffusion and DNA encoding, base XOR operation, and DNA decoding operations, including:
[0033] A diffusion matrix generated using a chaotic sequence is XORed with the third encrypted image. Then, the pixel data is encoded into a DNA base sequence according to dynamic rules, XORed with the key DNA sequence, and finally decoded into an encrypted image according to the rules.
[0034] Preferably, the diffusion matrix is generated using a chaotic sequence as follows:
[0035] ;
[0036] In the formula, For the i-th pixel in the image after the diffusion matrix is encrypted, For the i-th pixel in the third encrypted image, The discrete output of the y-variable sequence generated by the 2D-SQPM chaotic mapping during the iteration process is obtained after nonlinear mapping. The encrypted value of the previous pixel in the diffusion matrix. This is the discrete output of the x-variable sequence generated by the 2D-SQPM chaotic mapping during the iteration process, after nonlinear mapping.
[0037] On the other hand, to achieve the above objectives, the present invention also provides an image encryption system for implementing the image encryption method, comprising:
[0038] An initial image processing module is used to input the original image into a hash function to generate a hash value, construct a hash vector through the hash value, generate several key values after mapping, calculate the initial parameters of the chaotic system based on the key values, and generate a chaotic sequence.
[0039] The perturbation diffusion module is used to divide the original image into several non-overlapping image blocks of the same size after zero-filling, and to perform forward and reverse bidirectional cyclic shift operations on each image block to obtain the first encrypted image after diffusion.
[0040] The intra-block perturbation module is used to generate the starting position and jump step size of the Josephus ring based on the chaotic sequence, and dynamically rearrange the pixels in each image block to obtain the second encrypted image.
[0041] Inter-block scrambling module: used to group the rearranged image into image blocks, construct a Latin square matrix using chaotic sequences, rearrange the row and column positions of the image blocks, and obtain the third encrypted image;
[0042] The output module is used to perform global XOR diffusion, DNA encoding, base XOR operation and DNA decoding on the first encrypted image, the second encrypted image and the third encrypted image respectively, and output the final encrypted image.
[0043] Compared with the prior art, the present invention has the following advantages and technical effects:
[0044] (1) Strong reversibility and clear, reproducible structure. The present invention strictly follows the encryption-decryption symmetry principle in its structural design. All scrambling-diffusion is reversible, ensuring that the image can be completely restored without loss of information. It effectively solves the problem that existing irreversible image perturbation methods are difficult to restore, and has good practicality and engineering deployability.
[0045] (2) It has strong resistance to statistical analysis and can resist known plaintext attacks. By introducing a plaintext-sensitive key generation mechanism, the key is dynamically bound to different input images. Combined with a dual-round diffusion strategy, the avalanche effect is significantly enhanced, and it has higher security robustness in the face of attack scenarios such as statistical feature extraction, correlation analysis, and plaintext guessing.
[0046] (3) Lightweight and efficient, combining practicality and security. While ensuring structural complexity and security performance, this invention adopts a standard hash function and a lightweight chaotic system to avoid a large number of complex and redundant calculations, with low time complexity and resource consumption. It can also run efficiently on embedded or edge devices, combining security and computational efficiency. Attached Figure Description
[0047] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0048] Figure 1 This is a flowchart of an image encryption method based on a diffusion-scrambling-diffusion embodiment of the present invention;
[0049] Figure 2 This is a schematic diagram of Josephus scrambling in an embodiment of the present invention;
[0050] Figure 3 This is a schematic diagram of Latin square scrambling according to an embodiment of the present invention. Detailed Implementation
[0051] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0052] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0053] This embodiment proposes a diffusion-scrambling-diffusion image encryption method, such as... Figure 1 ,include:
[0054] The original image is input into the SHA-256 hash function to generate a hash value. A hash vector is constructed using the hash value. After mapping, several key values are generated. The initial parameters of the chaotic system are calculated based on the key values to generate a chaotic sequence.
[0055] The original image is zero-padded and divided into several non-overlapping image blocks of the same size. Each image block is then subjected to a forward and reverse bidirectional cyclic shift operation to obtain the first encrypted image after diffusion.
[0056] The starting position and jump step size of the Josephus ring are generated based on the chaotic sequence. The pixels in each image block of the first encrypted image are dynamically rearranged to obtain the second encrypted image.
[0057] The second encrypted image is divided into image blocks, a Latin square matrix is constructed using a chaotic sequence, and the row and column positions of the image blocks are rearranged to obtain the third encrypted image.
[0058] The third encrypted image is subjected to global XOR diffusion, DNA encoding, base XOR operation and DNA decoding operation to output the final encrypted image.
[0059] Furthermore, the chaotic sequence is generated using a lightweight two-dimensional chaotic map 2D-SQPM, specifically as follows:
[0060] ;
[0061] In the formula, , All of these are control parameters. Let be the next state independent variable based on the value generated at the i-th pixel in the 2D-SQPM chaotic mapping. Let be the independent variable corresponding to the i-th pixel generated by the 2D-SQPM chaotic mapping. Let be the dependent variable corresponding to the i-th pixel generated by the 2D-SQPM chaotic mapping. Let be the next state dependent variable of the 2D-SQPM chaotic mapping, based on the value generated at the i-th pixel.
[0062] Specifically, in this embodiment, it is assumed that the input is a sheet of size The original image P is recorded along with its dimensions. For the height of the original image, The width of the original image.
[0063] When the input image is a color image, it is processed separately for each of the RGB channels to obtain I_R, I_G, and I_B, with each channel processed independently. To achieve a close correlation between image structural features and perturbation control parameters, a plaintext-sensitive key generation mechanism is introduced in the preprocessing stage. The original image P is input into the SHA-256 hash function to generate a 256-bit hash value. The hash value is then divided into 32 parts of 8 bits each to form a hash vector. ; among them, each The formula for generating 8 key values is as follows: A byte in the hash value, after being converted from hexadecimal to decimal, is mapped to an integer value in the range [0, 255].
[0064] ;
[0065] ;
[0066] ;
[0067] ;
[0068] ;
[0069] ;
[0070] ;
[0071] ;
[0072] In the formula, The decimal representation of the t-th byte in the hash value; It consists of the 1st, 2nd, 17th, and 18th bytes of the hash value, which are used as intermediate key inputs coupled with the control parameters of the two-dimensional chaotic map; The hash value is composed of the 3rd, 4th, 19th, and 20th bytes, which serve as the intermediate key input and are coupled with the initial variables and control parameters of the two-dimensional chaotic map. It consists of the 5th, 6th, 21st, and 22nd bytes of the hash value, which are used as intermediate key inputs coupled with the control parameters of the two-dimensional chaotic map; The hash value is composed of the 7th, 8th, 23rd, and 24th bytes, which serve as the intermediate key input and are coupled with the initial variables and control parameters of the two-dimensional chaotic map. It consists of the 9th, 10th, 25th, and 26th bytes of the hash value, which are used as the intermediate key input and coupled with the initial variable of the two-dimensional chaotic map; It consists of the 11th, 12th, 27th, and 28th bytes of the hash value, which are used as intermediate key inputs coupled with the control parameters of the two-dimensional chaotic map; It consists of the 13th, 14th, 29th, and 30th bytes of the hash value, which are used as intermediate key inputs and coupled with the initial variables and control parameters of the two-dimensional chaotic map; It consists of the 15th, 16th, 31st, and 32nd bytes of the hash value, which are used as intermediate key inputs and coupled with the initial variables and control parameters of the two-dimensional chaotic map;
[0073] Generate the parameter values required for the chaotic system based on the key value combinations:
[0074] ;
[0075] ;
[0076] ;
[0077] ;
[0078] The chaos module uses a lightweight two-dimensional chaotic map, 2D-SQPM, to generate chaotic sequences. The 2D-SQPM formula is as follows:
[0079] ;
[0080] In the formula, Let be the initial independent variable of the two-dimensional chaotic mapping 2D-SQPM; Let be the initial dependent variable of the two-dimensional chaotic mapping 2D-SQPM; , All of these are control parameters. , ; The decimal representation of the t-th byte in the hash value; Let be the next state independent variable based on the value generated at the i-th pixel in the 2D-SQPM chaotic mapping. Let be the independent variable corresponding to the i-th pixel generated by the 2D-SQPM chaotic mapping. Let be the dependent variable corresponding to the i-th pixel generated by the 2D-SQPM chaotic mapping. Let be the next state dependent variable of the 2D-SQPM chaotic mapping, based on the value generated at the i-th pixel.
[0081] Furthermore, to ensure the image size is divisible, zero-padding is applied to the image edges before block division. The size of the image after zero-padding is denoted as M×N, where M is the height of the image after zero-padding and N is the width. The original image P is divided into several non-overlapping blocks of uniform size. The block size can be adjusted according to the image resolution and encryption precision, for example, 8×8, 16×16, or 32×32. In this embodiment, an 8×8 block division is used as an example, with all blocks serving as the smallest basic processing unit for subsequent encryption operations.
[0082] Furthermore, a bidirectional cyclic shift operation is performed on each image block, including:
[0083] Each image block is flattened into a one-dimensional vector of uniform length. An initial diffusion offset is generated based on the chaotic sequence. A cyclic self-displacement operation is performed using the initial diffusion offset, followed by a forward cyclic left shift and a reverse cyclic right shift operation to obtain the first encrypted image.
[0084] Specifically, after block processing, the resulting standardized 8×8 image blocks are each flattened into a one-dimensional pixel vector of length 64, denoted as... Chaotic sequences generated by the two-dimensional chaotic map SQPM An initial diffusion offset vector R is generated. Then, a cyclic self-shift is performed on the resulting initial diffusion offset vector to break the explicit correspondence between rules and positions. Its definition is as follows:
[0085] ;
[0086] In the formula, , where is the initial diffusion offset vector; K1 is the first pseudo-random sequence obtained by amplifying and quantizing the y variable sequence generated during the iteration process of the 2D-SQPM chaotic mapping, accumulating it, and taking the modulus of 255. K1 is the next state offset of the cyclic self-displacement diffusion operation; K1 is the chaotic sequence generated by the two-dimensional chaotic map SQPM. The result can be obtained by accumulating the mapping.
[0087] Then, a bidirectional bit-loop shift perturbation diffusion mechanism (i.e., forward cyclic left shift and reverse cyclic right shift operations) is used to perform forward diffusion on pixels within each block, as defined below:
[0088] ;
[0089] In the formula, The new encrypted image pixel is generated at the i-th pixel by forward cyclic left-shift diffusion; For the encrypted image pixel generated at the (i-1)th pixel; The two-dimensional chaotic mapping 2D-SQPM generates two components x and y during the iteration process, and the value mapping yields the second pseudo-random sequence. This is the offset generated at the i-th pixel by the cyclic self-displacement diffusion operation; ; This indicates a leftward circular shift operation; The 2D-SQPM chaotic mapping generates a sequence of x variables during the iteration process; The 2D-SQPM chaotic mapping generates a sequence of y variables during the iteration process; This is the value of the i-th pixel in the original image.
[0090] Perform another backdiffusion operation, as shown in the following formula:
[0091] ;
[0092] In the formula, The new encrypted image pixel is generated at the i-th pixel by reverse circular right-shift diffusion; The encrypted image pixel generated by reverse cyclic right-shift diffusion at the (i-1)th pixel; The 2D-SQPM two-dimensional chaotic mapping generates a third pseudo-random sequence by mapping the difference between the x and y components during the iteration process. The new encrypted image pixel is generated at the i-th pixel by forward cyclic left-shift diffusion; This is the offset generated in the reverse order of the sequence during the cyclic self-displacement diffusion operation; , This indicates that a rightward circular shift operation is performed via a bidirectional circular shift.
[0093] The position of each pixel has changed, but the size of the image block remains 8×8, resulting in the diffused encrypted image C1, which is the first encrypted image.
[0094] Furthermore, the starting position and jump step size of the Josephus ring are generated based on the chaotic sequence, including:
[0095] The pixels within the image block are converted into a one-dimensional array. The starting position and jump step size are generated based on the chaotic sequence. All pixel positions are traversed through the Josephus cycle rule to generate an access sequence and rearrange the pixels.
[0096] Specifically, after completing the bidirectional bit perturbation diffusion operation, this embodiment introduces a dynamic irregular perturbation scrambling mechanism, such as... Figure 2 Specifically, each 8×8 image block contains 64 pixels, which are converted into a one-dimensional array in row-major order. Chaotic sequences generated by the two-dimensional chaotic map SQPM and 'a' represents the total number of image patches. The sequence generated by the two-dimensional chaotic system... and Each value is mapped to an integer in the ranges [1, 64] and [0, 63] respectively:
[0097] ;
[0098] ;
[0099] In the formula, This indicates rounding down, for each... , is the control parameter for the access order of the nth image patch. The final result is two integer sequences. , Then, for one-dimensional arrays To perform encryption, first initialize a set of candidate indices. It represents the initial position number of all pixels in the current image patch. The initial index position to be accessed is selected as pos0, and pos0 is a sequence of integers. The control serves as the starting point for the Josephus jump sequence. Then, the Josephus jump number is set based on the image patch, the jump number being determined by an integer sequence. The access order is generated, controlling the step size for skipping pixels within each image block, and the skipping access begins. In each iteration, starting from the current position, skip pixels clockwise. After selecting a pixel at each position, its number is added to the access order list (Access), and the pixel position is removed from the Index. The jump operation uses a loop pattern, and in each round of access, the current position is updated according to the following rules:
[0100] ;
[0101] in, This indicates the index of the new position to be reached in the next jump; pos indicates the starting index of the current jump round, i.e., the position selected in the previous round; len(index) indicates the length of the current index list; The fourth pseudo-random sequence is obtained by amplifying the x-variable sequence generated during the iteration process of the 2D-SQPM chaotic map by 64 times, rounding it down, and adding one.
[0102] Since each selected pixel index is removed from the candidate list during the access process, the total number of indices gradually decreases. Therefore, to ensure that jumps always occur within the current remaining index range, modulo operations are used to control the jump position, ensuring that the access process is always valid and that all pixel indices can be traversed. This operation is repeated until all pixel positions in the Index have been accessed. This results in a non-repeating access sequence Access of length 64. Based on the access sequence Access, the pixels within the image patch are rearranged; specifically, the one-dimensional array in the original image patch is rearranged... pixels, according to Extract pixels in the specified order and place them into new pixel blocks: Access records and saves the access order during the encryption process to ensure the reversible rearrangement of the images, thereby ensuring the reversibility of the subsequent decryption process.
[0103] Furthermore, a third encrypted image is obtained, including:
[0104] The image blocks in the second encrypted image are grouped according to a preset size to form several image patching regions;
[0105] The row and column Latin squares are constructed using chaotic sequences, and the odd and even blocks in the image splicing area are perturbed by the column position mapping. After the perturbation is completed, all sub-block groups are spliced again to obtain the third encrypted image.
[0106] Specifically, after completing the scrambling operation, this embodiment introduces an inter-block staggered double Latin square perturbation mechanism, such as... Figure 3 The image with completed intra-block perturbation is considered to be composed of several 8×8 sub-blocks, with an image size of M×N, totaling... Each image block is further divided into 4×4 adjacent sub-blocks, ensuring the number of image blocks is divisible by 16. This creates several image patching regions, each 32×32 pixels in size, considered a basic perturbation unit. If the entire image is not divisible by 4 at the block level, zeros are added at the block level to satisfy the partitioning requirements. At this point, the image size is... Sequences generated using a two-dimensional chaotic system The perturbation block internal access path, serving as row coordinates, generates the Latin square access order. Specifically, from... Extract the first four values Y0~Y3, multiply each by 4, round down and remove duplicate elements. If there are fewer than four values, add missing elements to obtain the complete set {0,1,2,3}, as shown in the formula below: , The sixth pseudo-random sequence generated by the y-variable sequence produced during the iteration of the 2D-SQPM chaotic mapping is amplified and rounded down; then this set is taken as the first row L of the Latin square. a0 Subsequently, for each row of the constructed Latin square matrix, except for the first row, ... Extract the (n+3)th value and calculate its corresponding integer offset. , for L a0 Shift right by r i For each position, construct a new row. If the row is a duplicate of an existing row, take the next chaotic value and reconstruct until no duplicate rows are obtained, thus constructing the standard Latin square L. a. .
[0107] Similarly, sequences generated using a two-dimensional chaotic system The perturbation path within the even-numbered blocks, serving as column coordinates, generates the Latin square access order. Specifically, from... Extract the first s values X0~X s Multiply each element by s, round down and remove duplicates. If there are fewer than s elements, add the missing elements to obtain the complete set {0,1,2,3,…,s}, as shown in the formula below: , The seventh pseudo-random sequence generated by the 2D-SQPM chaotic mapping during iteration, after amplification and floor-rounding, is the first row L of the Latin square. b0 Subsequently, for the constructed Latin square matrix, except for the first column, each column is... Take the (n+s-1)th value from the set and calculate its corresponding integer offset. , for L b0 Shift left l i For each position, construct a new row. If the column is a duplicate of an existing column, take the next chaotic value and reconstruct until no duplicate columns are obtained, thus constructing the standard Latin square L. b .
[0108] Through standard Latin square L a Standard Latin Square L b The odd-numbered image blocks within the current block are perturbed by row coordinate mapping, and the even-numbered image blocks are perturbed by column coordinate mapping. After the perturbation is completed, all sub-block groups are reassembled to restore the complete two-dimensional image C3, which is the third encrypted image.
[0109] Furthermore, the third encrypted image undergoes global XOR diffusion and DNA encoding, base XOR operation, and DNA decoding operations, including:
[0110] A diffusion matrix generated using a chaotic sequence is XORed with the third encrypted image. Then, the pixel data is encoded into a DNA base sequence according to dynamic rules, XORed with the key DNA sequence, and finally decoded into an encrypted image according to the rules.
[0111] Specifically, the scrambled two-dimensional image C3 is initially diffused, and the chaotic sequence generated by the two-dimensional chaotic map SQPM is obtained. and Dynamically generate diffusion matrices K8 and K9 of image size C3. Perform a bitwise XOR diffusion operation between diffusion matrices K8 and K9 and C3. The diffusion formula is as follows:
[0112] ;
[0113] In the formula, For the i-th pixel in the image after the diffusion matrix is encrypted, For the i-th pixel in the third encrypted image, The discrete output of the y-variable sequence generated by the 2D-SQPM chaotic mapping during the iteration process is obtained after nonlinear mapping. The encrypted value of the previous pixel in the diffusion matrix. This is the discrete output of the x-variable sequence generated by the 2D-SQPM chaotic mapping during the iteration process, after nonlinear mapping.
[0114] Subsequently, the image C4, encrypted using the diffusion equation, is encoded with DNA. The grayscale value of each pixel is converted into a DNA base sequence (A, T, C, G) in groups of 2 bits, forming a DNA matrix C5.
[0115] Chaotic sequences generated by the two-dimensional chaotic map SQPM As a rule control sequence, it is mapped to integers between 1 and 8 to generate a rule vector. The calculation formula is as follows:
[0116] ;
[0117] For each pixel's 8-bit binary data in the image, according to the corresponding position... Dynamic encoding is performed using specified DNA encoding rules. Chaotic sequences are generated by the two-dimensional chaotic map SQPM. Construct a set of pseudo-random DNA sequences with the same C4 size as the image encrypted using the diffusion equation. In the DNA coding layer, a base-level XOR operation is performed on the image DNA matrix C5 and the key DNA matrix according to the DNA base XOR rule table to obtain the XORed DNA matrix C6, thus achieving image diffusion. This is based on the rule K used during encoding. 10 DNA decoding of C6 yields an encrypted image. .
[0118] Image decryption is the reverse process of encryption. Because the entire encryption process retains reversible design in operations such as block partitioning, scrambling, and diffusion, this technical solution supports the complete decryption reverse process, enabling lossless restoration of the original image.
[0119] Table 1 below shows the DNA coding rules, and Table 2 shows the DNA base XOR rules.
[0120] Table 1
[0121]
[0122] Table 2
[0123]
[0124] This embodiment also provides an image encryption system for implementing the image encryption method, including:
[0125] The initial image processing module is used to input the original image into the SHA-256 hash function to generate a hash value, construct a hash vector through the hash value, generate several key values after mapping, calculate the initial parameters of the chaotic system based on the key values, and generate a chaotic sequence.
[0126] The perturbation diffusion module is used to divide the original image into several non-overlapping image blocks of the same size after zero-filling, and to perform forward and reverse bidirectional cyclic shift operations on each image block to obtain the first encrypted image after diffusion.
[0127] The intra-block perturbation module is used to generate the starting position and jump step size of the Josephus ring based on the chaotic sequence, and dynamically rearrange the pixels in each image block to obtain the second encrypted image.
[0128] Inter-block scrambling module: used to group the rearranged image into image blocks, construct a Latin square matrix using chaotic sequences, rearrange the row and column positions of the image blocks, and obtain the third encrypted image;
[0129] The output module is used to perform global XOR diffusion, DNA encoding, base XOR operation and DNA decoding on the first encrypted image, the second encrypted image and the third encrypted image respectively, and output the final encrypted image.
[0130] The key generation mechanism in this embodiment is based on the SHA-256 hash function, which highly binds plaintext image information to the initial key. By structuring the hash value, the initial state and control parameters of the chaotic system are generated, ensuring that each image corresponds to a unique key configuration, achieving the adaptive encryption characteristic of "different keys for the same image". This method utilizes the avalanche effect of the hash function to ensure that even small pixel changes can trigger significant changes in the encryption system, enhancing the algorithm's sensitivity and resistance to decryption. Compared to traditional methods using fixed initial values or manually set parameters, this mechanism provides higher key randomness and unpredictability, while also possessing good reversibility and ease of implementation, providing high security, high consistency, and stronger dynamic response capabilities for the entire encryption process.
[0131] This embodiment proposes a diffusion-scrambling-diffusion image encryption structure, introducing a diffusion process before the traditional scrambling-diffusion operation to make the encryption process more perturbative. Compared to a single diffusion process, this dual-diffusion structure can propagate pixel perturbations over a wider range, significantly enhancing the diffusion and inter-pixel coupling strength in the image encryption process. Each round of diffusion operation uses independent parameters and perturbation logic, ensuring that the ciphertext is highly sensitive to changes in the plaintext, effectively improving the avalanche effect. Simultaneously, the dual-diffusion mechanism can expand the scope of key influence, allowing even small initial value changes to trigger nonlinear changes in the overall ciphertext, enhancing its resistance to statistical analysis and error propagation attacks.
[0132] This embodiment proposes a two-layer image scrambling structure based on Josephus ring perturbation and Latin square mapping to achieve spatial deconstruction and rearrangement of image pixels. In the intra-block perturbation stage, a pixel substitution algorithm based on the Josephus ring counting rule is designed. By setting the initial position and counting step size, controllable perturbation of pixels within each image block is achieved. This mechanism possesses characteristics such as path adjustability and perturbation balance, significantly enhancing the image's ability to scramble in local regions. In the inter-block perturbation stage, a Latin square matrix is introduced as a control template for image block position rearrangement. Its "row and column uniqueness" ensures that the new position of each image block in two-dimensional space is non-repeating and fully covers the entire block, forming a globally scrambling scheme with strong structure and moderate regularity. The combination of these two approaches balances local and global diffusion scrambling effects, and the perturbation parameter generation and restoration mechanism ensures the algorithm's reversibility and independence from image size.
[0133] This embodiment also proposes an image encryption structure based on whole-image lightweight diffusion and full-image DNA perturbation. The method first performs global perturbation on the original image, breaking the initial pixel distribution characteristics through simple and efficient modulo and XOR operations. DNA encoding, base XOR, and DNA decoding operations are then performed on the diffused image. A chaotic sequence is generated based on a dynamic key, and the image data is DNA encoded, converting it into a base sequence. Subsequently, a pairing operation is performed with a DNA rule table generated from another set of chaotic sequences, and base-level XOR operations are introduced during the DNA computation stage to achieve a two-layer perturbation of pixel information. Compared to traditional single DNA mapping or direct XOR operations, this technical solution enhances the unpredictability and diffusion of encrypted data through the coordinated perturbation of the encoding and computational domains, effectively resisting known-plaintext attacks and differential analysis, and is suitable for lightweight, high-strength security requirements in big data image scenarios.
[0134] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A diffusion-scrambling-diffusion image encryption method, characterized in that, include: The original image is input into a hash function to generate a hash value. A hash vector is constructed using the hash value. After mapping, several key values are generated. The initial parameters of the chaotic system are calculated based on the key values to generate a chaotic sequence. The original image is zero-padded and divided into several non-overlapping image blocks of the same size. Each image block is then subjected to a forward and reverse bidirectional cyclic shift operation to obtain the first encrypted image after diffusion. The starting position and jump step size of the Josephus ring are generated based on the chaotic sequence. The pixels in each image block of the first encrypted image are dynamically rearranged to obtain the second encrypted image. The second encrypted image is divided into image blocks, a Latin square matrix is constructed using a chaotic sequence, and the row and column positions of the image blocks are rearranged to obtain the third encrypted image. The third encrypted image is subjected to global XOR diffusion, DNA encoding, base XOR operation and DNA decoding operation to output the final encrypted image; The chaotic sequence is generated using a lightweight two-dimensional chaotic map 2D-SQPM, specifically as follows: ; In the formula, , All of these are control parameters. For the two-dimensional chaotic mapping 2D-SQPM in the th i The next state independent variable based on the generated values of each pixel. The first generation of the two-dimensional chaotic map 2D-SQPM i The independent variable corresponding to each pixel The first generation of the two-dimensional chaotic map 2D-SQPM i The dependent variable corresponding to each pixel For the two-dimensional chaotic mapping 2D-SQPM in the th i The next state dependent variable based on the generated values of each pixel; Perform bidirectional cyclic shift operations (forward and backward) on each image block, including: Each image block is flattened into a one-dimensional vector of uniform length. An initial diffusion offset is generated based on the chaotic sequence. A cyclic self-displacement operation is performed using the initial diffusion offset. Then, a forward cyclic left shift and a reverse cyclic right shift operation are performed to obtain the first encrypted image. Based on the chaotic sequence, the starting position and jump step size of the Josephus ring are generated, and the pixels within each image block in the first encrypted image are dynamically rearranged, including: The pixels within the image block are converted into a one-dimensional array. The starting position and jump step size are generated based on the chaotic sequence. All pixel positions are traversed through the Josephus cycle rule to generate an access sequence and rearrange the pixels. When traversing all pixel positions using the Josephus ring rule, the update rule for the current position in each round of visits is as follows: ; In the formula, This indicates the index of the new position reached in the next jump. pos This indicates the starting position index of the current jump round. len ( index () indicates the length of the current index list. The fourth pseudo-random sequence is obtained by amplifying the x variable sequence generated during the iteration process of the two-dimensional chaotic mapping 2D-SQPM by 64 times, rounding it down and adding one; Obtain the third encrypted image, including: The image blocks in the second encrypted image are grouped according to a preset size to form several image patching regions; Using chaotic sequences, row Latin squares and column Latin squares are constructed respectively. The odd-numbered blocks and even-numbered blocks in the image stitching region are perturbed by the column position mapping. After the perturbation is completed, all sub-block groups are re-stitched to obtain the third encrypted image. The third encrypted image undergoes global XOR diffusion, DNA encoding, base XOR operation, and DNA decoding operations, including: A diffusion matrix generated using a chaotic sequence is XORed with the third encrypted image. Then, the pixel data is encoded into a DNA base sequence according to dynamic rules, XORed with the key DNA sequence, and finally decoded into an encrypted image according to the rules.
2. The image encryption method according to claim 1, characterized in that, The cyclic self-displacement operation is performed using the initial diffusion offset, specifically as follows: ; In the formula, R This is the initial diffusion offset. The first pseudo-random sequence is obtained by amplifying and quantizing the y-variable sequence generated during the iteration process of the 2D-SQPM chaotic mapping, accumulating the sequences, and taking the modulus of 255. This is the offset of the next state in the cyclic self-displacement diffusion operation.
3. The image encryption method according to claim 1, characterized in that, The diffusion matrix is generated using a chaotic sequence as follows: ; In the formula, The first image after the diffusion matrix is encrypted i 1 pixel For the third encrypted image i 1 pixel The discrete output of the y-variable sequence generated by the 2D-SQPM chaotic mapping during the iteration process is obtained after nonlinear mapping. The encrypted value of the previous pixel in the diffusion matrix. This is the discrete output of the x-variable sequence generated by the 2D-SQPM chaotic mapping during the iteration process, after nonlinear mapping.
4. An image encryption system for implementing the image encryption method according to any one of claims 1-3, characterized in that, include: An initial image processing module is used to input the original image into a hash function to generate a hash value, construct a hash vector through the hash value, generate several key values after mapping, calculate the initial parameters of the chaotic system based on the key values, and generate a chaotic sequence. The perturbation diffusion module is used to divide the original image into several non-overlapping image blocks of the same size after zero-filling, and to perform forward and reverse bidirectional cyclic shift operations on each image block to obtain the first encrypted image after diffusion. The intra-block perturbation module is used to generate the starting position and jump step size of the Josephus ring based on the chaotic sequence, and to dynamically rearrange the pixels in each image block of the first encrypted image to obtain the second encrypted image. The inter-block scrambling module is used to group the rearranged image into image blocks, construct a Latin square matrix using a chaotic sequence, rearrange the row and column positions of the image blocks, and obtain the third encrypted image. The output module is used to perform global XOR diffusion, DNA encoding, base XOR operation and DNA decoding on the third encrypted image, and output the final encrypted image. The third encrypted image undergoes global XOR diffusion, DNA encoding, base XOR operation, and DNA decoding operations, including: A diffusion matrix generated using a chaotic sequence is XORed with the third encrypted image. Then, the pixel data is encoded into a DNA base sequence according to dynamic rules, XORed with the key DNA sequence, and finally decoded into an encrypted image according to the rules.
Citation Information
Patent Citations
Image encryption method based on pixel information association of hyperchaotic system
CN107819580A
An image encryption method based on Latin square matrix scrambling and bidirectional diffusion
CN109102452A
Image encryption method based on Y-shaped filling curve and variable-step Josephh traversal
CN112202545A