Image encryption method, device and equipment based on chaotic mapping
Through the image encryption method based on chaotic mapping, chaotic sequences and pixel coordinate matrices are generated to realize unpredictability and random encryption of images, solving the problem of easy prediction of image encryption in the prior art, and improving the security and efficiency of image transmission.
Patent Information
- Application Number
- CN202510469325.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2025-07-11
AI Technical Summary
The existing image encryption methods are easy to predict, have insufficient security, and it is difficult to effectively protect the data integrity and privacy of images during transmission.
The image encryption method based on chaos mapping is adopted to achieve unpredictability and random encryption of image pixels by generating chaotic sequences, chaotic matrices and pixel coordinate matrices, including pixel obfuscation, diffusion and replacement processing.
It improves the unpredictability and randomness of image encryption, enhances the security of image transmission, and effectively resists attacks, especially when applied in resource-constrained underwater wireless sensor networks.
Smart Images

Figure CN120301982A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image encryption technology, and in particular, to an image encryption method, device and equipment based on chaotic mapping. Background Art
[0002] With the rapid development of image technology and the popularization of the Internet, images are increasingly widely used in many fields such as social media, medical imaging, military communication, and financial payment.
[0003] There are many threats during the transmission of images, such as data tampering and information leakage. To improve the security of image transmission, related technologies can encrypt the images before transmission.
[0004] Related technologies generally perform image encryption based on symmetric encryption algorithms or frequency domain transformation to obtain image encryption data. However, the image encryption methods of related technologies are easy to predict and lack security. Summary of the Invention
[0005] The present invention provides an image encryption method, device and equipment based on chaotic mapping, which is used to solve the defect that the image encryption method in related technologies is easy to predict and lacks security, enhance the unpredictability of image encryption, and enhance the security of image encryption.
[0006] In a first aspect, the present invention provides an image encryption method based on chaotic mapping, including: Based on a set key, a established one-dimensional chaotic mapping, and the total number of pixel points in the image to be encrypted, generating a chaotic sequence including a plurality of chaotic elements, where the total number of elements in the chaotic sequence is equal to the total number of pixel points; According to the total number of pixel rows and the total number of pixel columns in the image to be encrypted, and a set element arrangement order, arranging the plurality of chaotic elements in the chaotic sequence to generate a chaotic matrix; wherein, the total number of rows and the total number of columns in the chaotic matrix are respectively equal to the total number of pixel rows and the total number of pixel columns; In the chaotic matrix, respectively determining the first size sorting of each chaotic element in the corresponding row data and the second size sorting in the corresponding column data, and respectively combining the first size sorting and the second size sorting of each chaotic element to obtain the coordinate data of each chaotic element; Respectively arranging the coordinate data of each chaotic element based on the distribution position of each chaotic element in the chaotic matrix to generate a corresponding matrix as the pixel coordinate matrix; wherein, the distribution position of any chaotic element in the chaotic matrix corresponds to the distribution position of the coordinate data of the chaotic element in the pixel coordinate matrix; Perform pixel encryption on the image to be encrypted based on the pixel coordinate matrix to obtain image encryption data.
[0007] Optionally, the performing pixel encryption on the image to be encrypted based on the pixel coordinate matrix to obtain image encryption data includes: Perform pixel scrambling in the pixel matrix corresponding to the image to be encrypted based on the pixel coordinate matrix to obtain a pixel scrambling matrix; Perform pixel diffusion on the pixel scrambling matrix according to the one-dimensional chaotic map and the pixel coordinate matrix to obtain a pixel diffusion matrix; Perform pixel substitution on the pixel diffusion matrix based on the one-dimensional chaotic map to obtain a pixel substitution matrix, which is used as the image encryption data.
[0008] Optionally, the performing pixel scrambling in the pixel matrix corresponding to the image to be encrypted based on the pixel coordinate matrix to obtain a pixel scrambling matrix includes: For the first element in the first row and first column of the pixel matrix, determine the corresponding first coordinate data in each of the coordinate data of the pixel coordinate matrix according to the row order and column order of the first element in the pixel matrix. Use the first size sorting and the second size sorting in the first coordinate data as the target row order and the target column order respectively. According to the target row order and the target column order, determine the corresponding second coordinate data in the pixel coordinate matrix, and find the target element corresponding to the position in the pixel matrix. Swap the first coordinate data and the second coordinate data in the pixel coordinate matrix to obtain a new pixel coordinate matrix, and swap the first element and the target element in the pixel matrix to obtain a new pixel matrix; For the second element in the first row and second column of the new pixel matrix, determine the corresponding coordinate data in the new pixel coordinate matrix according to the row order and column order of the second element in the new pixel matrix until the swapping of the elements in the last row and last column is completed, to obtain the latest pixel matrix, which is used as the pixel scrambling matrix.
[0009] Optionally, the total number of rows and the total number of columns in the pixel coordinate matrix are respectively equal to the total number of rows and the total number of columns in the pixel scrambling matrix; The performing pixel diffusion on the pixel scrambling matrix according to the one-dimensional chaotic map and the pixel coordinate matrix to obtain a pixel diffusion matrix includes: Traverse each row data in the pixel scrambling matrix in ascending order of row order; For the row data with row order N in the pixel confusion matrix traversed, if N is odd, determine the Nth largest sorting among the respective second-sized sortings of the first row data in the pixel coordinate matrix, determine the combined data including the Nth largest sorting in the pixel coordinate matrix as the target combined data, determine the target column order where the target combined data is located in the pixel coordinate matrix, determine the target column data corresponding to the target column order in the pixel confusion matrix, and determine the position to the right of the first column data as the column position to be inserted; If N is even, determine the position below the row data with row order N in the pixel confusion matrix as the row position to be inserted; According to the one-dimensional chaotic mapping, all the column positions to be inserted and the row positions to be inserted, perform pixel diffusion on the pixel confusion matrix to obtain the pixel diffusion matrix.
[0010] Optionally, the performing pixel diffusion on the pixel confusion matrix according to the one-dimensional chaotic mapping, all the column positions to be inserted and the row positions to be inserted to obtain the pixel diffusion matrix includes: In the order of the sequence of all the column positions to be inserted and the row positions to be inserted, insert blank columns or blank rows in the pixel confusion matrix, and before each execution of the next insertion operation, sequentially generate a new plurality of chaotic elements based on the first chaotic mapping and sequentially write them into the inserted blank columns or blank rows to obtain the pixel diffusion matrix.
[0011] Optionally, the performing pixel replacement on the pixel diffusion matrix based on the one-dimensional chaotic mapping to obtain the pixel replacement matrix includes: Generate a target chaotic matrix based on the one-dimensional chaotic mapping, the total number of rows and columns in the pixel diffusion matrix; wherein the total number of rows and columns in the target chaotic matrix is respectively equal to the total number of rows and columns in the pixel diffusion matrix; Perform an exclusive OR operation on each group of elements with corresponding distribution positions in the pixel diffusion matrix and the target chaotic matrix to obtain a first exclusive OR matrix; For any row data in the first exclusive OR matrix, starting from the second element in the row data, perform an exclusive OR operation on the current element and the previous element, obtain the operation result and replace the current element until the exclusive OR operation on the last element in the row data is completed and the replacement is finished; Use the matrix obtained after all replacement processes as the pixel replacement matrix.
[0012] Optionally, the one-dimensional chaotic mapping is generated by combining a sine mapping, a logical mapping, and a non-linear function.
[0013] Optionally, after obtaining the image encryption data, the method further includes: Sending the image encryption data and the key to a target device, so that the target device decrypts the image encryption data based on the key and the stored one-dimensional chaotic map to obtain a target image corresponding to the image to be encrypted.
[0014] In a second aspect, the present invention provides an image encryption device based on a chaotic map, including: A first generation unit, configured to generate a chaotic sequence including a plurality of chaotic elements based on a set key, a well-established one-dimensional chaotic map, and the total number of pixel points in the image to be encrypted; wherein, the total number of elements in the chaotic sequence is equal to the total number of pixel points; A second generation unit, configured to arrange the plurality of chaotic elements in the chaotic sequence according to the total number of pixel rows and the total number of pixel columns in the image to be encrypted, and a set element arrangement order, to generate a chaotic matrix; wherein, the total number of rows and the total number of columns in the chaotic matrix are respectively equal to the total number of pixel rows and the total number of pixel columns; A sorting determination unit, configured to respectively determine a first size sorting of each chaotic element in the corresponding row data and a second size sorting of each chaotic element in the corresponding column data in the chaotic matrix; A sorting combination unit, configured to respectively combine the first size sorting and the second size sorting of each chaotic element to obtain coordinate data of each chaotic element; A third generation unit, configured to respectively arrange the coordinate data of each chaotic element based on the distribution position of each chaotic element in the chaotic matrix to generate a corresponding matrix as a pixel coordinate matrix; wherein, the distribution position of any chaotic element in the chaotic matrix corresponds to the distribution position of the coordinate data of the chaotic element in the pixel coordinate matrix; An image encryption unit, configured to perform pixel encryption on the image to be encrypted based on the pixel coordinate matrix to obtain image encryption data.
[0015] In a third aspect, the present invention provides a computer device, including: a memory and a processor, which are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to execute the image encryption method based on a chaotic map according to the first aspect or any corresponding embodiment thereof.
[0016] In a fourth aspect, the present invention provides a computer-readable storage medium, on which computer instructions are stored, and the computer instructions are used to cause a computer to execute the image encryption method based on a chaotic map according to the first aspect or any corresponding embodiment thereof.
[0017] The image encryption method, device, and equipment based on chaotic mapping provided by the present invention can generate a chaotic sequence including multiple chaotic elements based on a set key, a well-established one-dimensional chaotic mapping, and the total number of pixel points in the image to be encrypted; wherein, the total number of elements in the chaotic sequence is equal to the total number of pixel points. According to the total number of pixel rows and the total number of pixel columns in the image to be encrypted, and the set element arrangement order, the multiple chaotic elements in the chaotic sequence are arranged to generate a chaotic matrix; wherein, the total number of rows and the total number of columns in the chaotic matrix are respectively equal to the total number of pixel rows and the total number of pixel columns. In the chaotic matrix, the first size sorting of each chaotic element in the corresponding row data and the second size sorting of each chaotic element in the corresponding column data are respectively determined, and the first size sorting and the second size sorting of each chaotic element are respectively combined to obtain the coordinate data of each chaotic element. Based on the distribution position of each chaotic element in the chaotic matrix, the coordinate data of each chaotic element is arranged to generate a corresponding matrix and used as the pixel coordinate matrix; wherein, the distribution position of any chaotic element in the chaotic matrix corresponds to the distribution position of the coordinate data of the chaotic element in the pixel coordinate matrix. The image to be encrypted is pixel-encrypted based on the pixel coordinate matrix to obtain image encryption data. The image encryption method of the present invention has unpredictability and randomness, effectively enhancing the security of the image encryption data. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the present invention or related technologies, the following will briefly introduce the drawings required for use in the embodiments or related technology descriptions. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0019] Figure 1 It is a flowchart of an image encryption method based on chaotic mapping provided by an embodiment of the present invention; Figure 2 It is a schematic diagram of the generation process of a pixel coordinate matrix provided by an embodiment of the present invention; Figure 3 It is a flowchart of another image encryption method based on chaotic mapping provided by an embodiment of the present invention; Figure 4 It is a schematic diagram of a pixel scrambling process provided by an embodiment of the present invention; Figure 5 It is a schematic diagram of another pixel scrambling process provided by an embodiment of the present invention; Figure 6 It is a schematic diagram of a pixel diffusion process provided by an embodiment of the present invention Figure 7Schematic structural diagram of an image encryption device based on chaotic mapping provided by an embodiment of the present invention; Figure 8 Schematic structural diagram of a computer device provided by an embodiment of the present invention. Detailed implementation manners
[0020] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without making creative efforts fall within the scope of protection of the present invention.
[0021] The following combines Figures 1-6 to describe the image encryption method based on chaotic mapping of the present invention.
[0022] As Figure 1 shown, the first image encryption method based on chaotic mapping is proposed in this embodiment, and the method may include the following steps: S101. Generate a chaotic sequence including a plurality of chaotic elements based on a set key, a well-established one-dimensional chaotic mapping, and the total number of pixel points in the image to be encrypted; wherein, the total number of elements in the chaotic sequence is equal to the total number of pixel points.
[0023] Many one-dimensional chaotic mappings in the related art have problems such as few control parameters, narrow chaotic range, and low sensitivity, resulting in relatively ordered pseudo-random sequences generated and low encryption security. Through research by the inventors of the present invention, it is found that by combining multiple chaotic mappings and non-linear functions, this drawback can be effectively alleviated. Therefore, a chaotic system combining sine Sine mapping and logistic Logistic mapping and introducing the Sigmoid non-linear function is proposed.
[0024] Optionally, the one-dimensional chaotic mapping in this embodiment can be generated by combining sine mapping, logistic mapping, and non-linear functions.
[0025] Among them, Sine mapping and Logistic mapping are two commonly used one-dimensional chaotic mappings. Although the structures of Sine mapping and Logistic mapping are simple, the parameter ranges are too small and the degree of chaos is limited. When the parameter in the Sine mapping, the Sine mapping is in a completely chaotic state. When the parameter in the Logistic mapping, the Logistic mapping is in a completely chaotic state. The Sigmoid function is a common S-shaped function with a high degree of non-linearity.
[0026] Specifically, this embodiment can combine the Sine map, Logistic map, and Sigmoid function to propose a new one-dimensional chaotic map (Sine-Logistic-Sigmoid, 1D-SLS), and its non-linear iterative function is defined as follows:
[0027] where , is the i th chaotic element, i is the serial number of the chaotic element, and are control parameters, , . When and , its chaotic dynamic behavior performs best.
[0028] It should be noted that 1D-SLS is a chaotic system that combines the Sine map and the Logistic map and introduces the Sigmoid non-linear function. 1D-SLS not only has a simple structure, but also has chaotic characteristics such as a wide chaotic range, high sensitivity, and strong unpredictability. This embodiment can perform image encryption based on the proposed one-dimensional chaotic map 1D-SLS. This embodiment can first design a key, input the key into the one-dimensional chaotic map to generate a chaotic sequence including multiple chaotic elements, and this chaotic sequence is generated for image encryption. Generally speaking, the larger the key space, the higher the security. When the key space is greater than , it can effectively resist brute-force cracking attacks.
[0029] Specifically, the key of this embodiment can be set to 256 bits, which can fully resist brute-force attacks. Among them, is the original initial value, , is the control parameter of the initial value, , , and are related modification coefficients, , . The parameters of the key are all floating-point numbers, and the precision is . The size calculation formula of the key is as follows: .
[0030] This shows that the total key space size of 1D-SLS is , which greatly improves the security of the system. The initial value calculation formula of the chaotic sequence used for encryption is as follows:
[0031] Specifically, in this embodiment, a chaotic sequence can be generated by 1D-SLS according to the initial value , and used for image encryption.
[0032] Specifically, in this embodiment, the set key can be input into the established one-dimensional chaotic mapping, so that the one-dimensional chaotic mapping generates a chaotic sequence. This embodiment can determine the total number P of pixel points in the image to be encrypted, extract the first P chaotic elements from the chaotic sequence, and use the extracted first P chaotic elements as a whole as the chaotic sequence. Of course, this embodiment can also directly instruct the one-dimensional chaotic mapping to generate a chaotic sequence including P chaotic elements based on the key and use it as the chaotic sequence.
[0033] S102. According to the total number of pixel rows and the total number of pixel columns in the image to be encrypted, and the set element arrangement order, arrange a plurality of chaotic elements in the chaotic sequence to generate a chaotic matrix; wherein, the total number of rows and the total number of columns in the chaotic matrix are respectively equal to the total number of pixel rows and the total number of pixel columns.
[0034] It can be understood that when there are X rows of pixel points and Y columns of pixel points in the image to be encrypted, the total number of pixel rows is X, and the total number of pixel columns is Y.
[0035] Specifically, when there are X rows of pixel points and Y columns of pixel points in the image to be encrypted, in this embodiment, the chaotic elements in the chaotic sequence can be arranged in order from front to back, or from back to front, or at equal intervals, etc., to construct a matrix with X rows and Y columns and use it as the chaotic matrix. For example, in this embodiment, the 1st to Xth chaotic elements in the chaotic sequence can be used as the row data of the 1st row in the matrix to be constructed, the (X + 1)th to 2Xth chaotic elements can be used as the row data of the 2nd row in the matrix to be constructed, until a chaotic matrix with X rows and Y columns is constructed. For another example, in this embodiment, the last 1st to last Xth chaotic elements in the chaotic sequence can be used as the row data of the 1st row in the matrix to be constructed, the last (X + 1)th to 2Xth chaotic elements can be used as the row data of the 2nd row in the matrix to be constructed, until a chaotic matrix with X rows and Y columns is constructed. For another example, in this embodiment, starting from the front, taking the 1st, 3rd, 5th... to (2X - 1)th chaotic elements as the row data of the 1st row in the matrix to be constructed, the 2Xth to (4X - 2)th chaotic elements as the row data of the 2nd row in the matrix to be constructed, until a chaotic matrix with X rows and Y columns is constructed.
[0036] S103. In the chaotic matrix, respectively determine the first size sorting of each chaotic element in the corresponding row data and the second size sorting in the corresponding column data.
[0037] Specifically, in this embodiment, in the chaos matrix, the chaos elements in each row data are sorted in descending order to determine the size sorting of each chaos element in the row data in the row data, that is, the first size sorting. For example, when the row data of the first row is 11, 10, 8, and 4, this embodiment can sort the chaos elements in this row data in descending order to determine the size sorting of each chaos element in this row data in this row data. The first size sortings of 11, 10, 8, and 4 in this row data are 1, 2, 3, and 4 respectively.
[0038] Specifically, in this embodiment, in the chaos matrix, the chaos elements in each column data are sorted in descending order to determine the size sorting of each chaos element in the column data in the column data, that is, the second size sorting. For example, when the column data of the first column is 11, 6, 15, 9, this embodiment can sort the chaos elements in this column data in descending order to determine the size sorting of each chaos element in this column data in this column data. The first size sortings of 11, 6, 15, 9 in this column data are 2, 4, 1, and 3 respectively.
[0039] S104. Combine the first size sorting and the second size sorting of each chaos element respectively to obtain the coordinate data of each chaos element.
[0040] Specifically, for any chaos element in the chaos matrix in this embodiment, the first size sorting and the second size sorting of this chaos element can be combined to obtain the coordinate data of this chaos element. For example, for the above chaos element 11, its first size sorting is 1 and its second size sorting is 2, then this embodiment can combine 1 and 2 to obtain the coordinate data (1, 2) of this chaos element.
[0041] S105. Arrange the coordinate data of each chaos element respectively based on the distribution position of each chaos element in the chaos matrix to generate a corresponding matrix and use it as the pixel coordinate matrix. Among them, the distribution position of any chaos element in the chaos matrix corresponds to the distribution position of the coordinate data of the chaos element in the pixel coordinate matrix.
[0042] Optionally, such as Figure 2As shown, after determining the first size sorting and the second size sorting of each chaotic element in the Chaos Matrix A, according to the distribution position of each chaotic element in the chaotic matrix, the first size sorting of each chaotic element is subjected to row sorting to generate a row sorting matrix Row Matrix B, and the second size sorting of each chaotic element is subjected to column sorting to generate a column sorting matrix Column Matrix C. In this embodiment, the row sorting matrix Row Matrix B and the column sorting matrix Column Matrix C can be combined to obtain a pixel coordinate matrix Column matrix D.
[0043] It can be understood that, as can be seen from Figure 2 the randomness of the row sorting matrix B and the column sorting matrix C ensures the complete randomness of the pixel coordinate matrix D.
[0044] It should be noted that the distribution position of any chaotic element in the chaotic matrix corresponds to the distribution position of the coordinate data of this chaotic element in the pixel coordinate matrix. For example, if a certain chaotic element in the chaotic matrix is in the position of the first row and the first column, then the coordinate data of this chaotic element is in the position of the first row and the first column in the pixel coordinate matrix.
[0045] S106. Pixel-encrypt the image to be encrypted based on the pixel coordinate matrix to obtain image encryption data.
[0046] It can be understood that the total number of rows and the total number of columns in the pixel coordinate matrix are respectively equal to the total number of pixel rows and the total number of pixel columns in the image to be encrypted. Each coordinate data in the pixel coordinate matrix can be used to perform position confusion on the pixels corresponding to the distribution positions in the image to be encrypted, so as to encrypt the image to be encrypted and improve the security performance of image encryption.
[0047] The image encryption method based on chaotic mapping proposed in this embodiment can generate a chaotic sequence including multiple chaotic elements based on a set key, a well-established one-dimensional chaotic mapping, and the total number of pixel points in the image to be encrypted; wherein, the total number of elements in the chaotic sequence is equal to the total number of pixel points. According to the total number of pixel rows and the total number of pixel columns in the image to be encrypted, and the set element arrangement order, the multiple chaotic elements in the chaotic sequence are arranged to generate a chaotic matrix; wherein, the total number of rows and the total number of columns in the chaotic matrix are respectively equal to the total number of pixel rows and the total number of pixel columns. In the chaotic matrix, the first size sorting of each chaotic element in the corresponding row data and the second size sorting in the corresponding column data are respectively determined, and the first size sorting and the second size sorting of each chaotic element are respectively combined to obtain the coordinate data of each chaotic element. Based on the distribution position of each chaotic element in the chaotic matrix, the coordinate data of each chaotic element are arranged to generate a corresponding matrix as the pixel coordinate matrix; wherein, the distribution position of any chaotic element in the chaotic matrix corresponds to the distribution position of the coordinate data of the chaotic element in the pixel coordinate matrix. The image to be encrypted is pixel-encrypted based on the pixel coordinate matrix to obtain image encryption data. The image encryption method in this embodiment has unpredictability and randomness, effectively enhancing the security of the image encryption data.
[0048] Based on Figure 1 , as Figure 3 shown, this embodiment proposes a second image encryption method based on chaotic mapping. In this method, step S106 may include: S1061. Based on the pixel coordinate matrix, perform pixel confusion in the pixel matrix corresponding to the image to be encrypted to obtain a pixel confusion matrix; S1062. According to the one-dimensional chaotic mapping and the pixel coordinate matrix, perform pixel diffusion on the pixel confusion matrix to obtain a pixel diffusion matrix; S1063. Based on the one-dimensional chaotic mapping, perform pixel replacement on the pixel diffusion matrix to obtain a pixel replacement matrix as the image encryption data.
[0049] Specifically, in this embodiment, after generating the pixel coordinate matrix, pixel confusion, pixel diffusion, pixel replacement, etc. can be performed on the pixel matrix corresponding to the image to be encrypted based on the pixel coordinate matrix, and finally image encryption data is obtained, realizing the encryption process of the image to be encrypted, enhancing unpredictability and randomness, and enhancing the security of the image encryption data.
[0050] Optionally, step S1061 includes: For the first element in the first row and first column of the pixel matrix, according to the row order and column order of the first element in the pixel matrix, among the respective coordinate data of the pixel coordinate matrix, determine the corresponding first coordinate data of the position. Take the first size sorting and the second size sorting in the first coordinate data as the target row order and the target column order respectively. According to the target row order and the target column order, determine the corresponding second coordinate data of the position in the pixel coordinate matrix, and search for the target element corresponding to the position in the pixel matrix. Swap the first coordinate data and the second coordinate data in the pixel coordinate matrix to obtain a new pixel coordinate matrix, and swap the first element and the target element in the pixel matrix to obtain a new pixel matrix; For the second element in the first row and second column of the new pixel matrix, according to the row order and column order of the second element in the new pixel matrix, among the respective coordinate data of the new pixel coordinate matrix, determine the corresponding coordinate data of the position until the swapping of the elements in the last row and last column is completed, to obtain the latest pixel matrix, which is used as the pixel scrambling matrix.
[0051] As Figure 4 shown and Figure 5 shown, the pixel coordinate matrix D will be used for pixel scrambling and diffusion operations of the image, so as to improve the security during the image transmission process. Figure 4 and Figure 5 show the pixel scrambling process based on the pixel coordinate positioning method, and effectively scramble by locating the random coordinates of the pixels row by row. The pixel coordinate matrix corresponds to the random coordinates of each pixel in the pixel matrix, and the pixels are repositioned to their corresponding actual coordinates according to these random coordinates and their positions are swapped. The same colors and red arrows in the figure mark the pixel positions that need to be swapped each time. The results show that the pixel arrangement of the scrambled image is completely disrupted and presents a disordered state. This scrambling process can significantly reduce the correlation between pixels with only a single round of position swapping. At the same time, since the entire process only depends on a chaotic sequence, the running efficiency of the algorithm is significantly improved.
[0052] Figure 4 and Figure 5Among them, the column matrix D is the pixel coordinate matrix, and the pixel matrix E is the pixel matrix. In this embodiment, when performing pixel scrambling, for the first element 153 in the first row and first column of the pixel matrix, according to the row order and column order of the first element 153 in the pixel matrix, the first coordinate data (4, 6) in the first row and first column is determined in the pixel coordinate matrix. Taking 4 and 6 as the target row order and target column order respectively, the second coordinate data (6, 6) located in the 4th row and 6th column is determined in the pixel coordinate matrix, and the target element 206 located in the 4th row and 6th column is determined in the pixel matrix. Then, in the pixel coordinate matrix, the first coordinate data (4, 6) and the second coordinate data (6, 6) are swapped to obtain a new pixel coordinate matrix, and in the pixel matrix, the first element 153 and the target element 206 are swapped to obtain a new pixel matrix.
[0053] After that, for the second element 41 in the first row and second column of the new pixel matrix in this embodiment, according to the row order and column order of the second element 41 in the new pixel matrix, the coordinate data (5, 5) in the first row and second column is determined in the new pixel coordinate matrix. Taking 5 and 5 as the target row order and target column order respectively, the coordinate data (2, 1) located in the 5th row and 5th column is determined in the new pixel coordinate matrix, and the element 72 located in the 4th row and 6th column is determined in the new pixel matrix. Then, in the new pixel coordinate matrix, the coordinate data (5, 5) in the first row and second column and the coordinate data (2, 1) in the 5th row and 5th column are swapped to obtain an updated pixel coordinate matrix, and in the new pixel matrix, the second element 41 in the first row and second column and the element 72 in the 5th row and 5th column are swapped to obtain an updated pixel matrix.
[0054] After that, for the third element 52 in the first row and third column of the new pixel matrix in this embodiment, continue to loop and process until the swapping is completed based on the element in the last row and last column of the matrix, obtaining the latest pixel matrix, which is used as the pixel scrambling matrix to complete pixel scrambling.
[0055] It should be noted that Figure 4 shows the result obtained by performing pixel scrambling based on the row data from the first row to the third row in the pixel matrix and the pixel coordinate matrix. Figure 4 In [the figure], First line transform is the first row transform, Secondline transform is the second row transform, and Third line transform is the third row transform, which respectively refer to the result display after transforming the data of the first row, the second row, and the third row.
[0056] Figure 5It shows the result obtained by pixel scrambling based on the row data from the 4th to the 6th rows in the pixel matrix and the pixel coordinate matrix. Figure 5 In Figure 5 , Fourth line transform refers to the transform of the 4th row, Fifth line transform refers to the transform of the 5th row, and Sixth line transform refers to the transform of the 6th row, which respectively refer to the result display obtained after transforming the 4th row data, the 5th row data, and the 6th row data.
[0057] Optionally, the total number of rows and the total number of columns in the pixel coordinate matrix are respectively equal to the total number of rows and the total number of columns in the pixel scrambling matrix. Step S1062 includes: Traverse each row data in the pixel scrambling matrix in ascending order of row order; For the row data with row order N in the pixel scrambling matrix traversed, if N is odd, determine the Nth largest sorting among the various second-sized sortings of the first row data in the pixel coordinate matrix, determine the combined data including the Nth largest sorting in the pixel coordinate matrix as the target combined data, determine the target column order where the target combined data is located in the pixel coordinate matrix, determine the target column data corresponding to the target column order in the pixel scrambling matrix, and determine the position on the right side of the first column data as the column position to be inserted; If N is even, determine the position below the row data with row order N in the pixel scrambling matrix as the row position to be inserted; According to the one-dimensional chaotic mapping, all the column positions to be inserted, and the row positions to be inserted, perform pixel diffusion on the pixel scrambling matrix to obtain the pixel diffusion matrix.
[0058] Specifically, in this embodiment, each row data in the pixel scrambling matrix can be traversed in ascending order of row order.
[0059] Specifically, in this embodiment, for the first row data with row order 1 in the pixel scrambling matrix traversed, it is determined that the first row data is an odd row, so determine the largest sorting among the various second-sized sortings of the first row data in the pixel coordinate matrix, determine the first column order where the combined data including this largest sorting is located in the pixel coordinate matrix, determine the first column data corresponding to the first column order in the pixel scrambling matrix, and determine the position on the right side of the first column data as the column position to be inserted.
[0060] Specifically, in this embodiment, for the second row data with row order 2 in the pixel scrambling matrix traversed, it is determined that the second row data is an even row, so the position below the second row data can be directly determined as the row position to be inserted.
[0061] Specifically, for the third row data with a row order of 3 in the pixel scrambling matrix traversed in this embodiment, if it is determined that the third row data is an odd row, then the second-largest sorting is determined among the respective second-size sortings of the first row data in the pixel coordinate matrix. The second column order where the combined data including this second-largest sorting is located is determined in the pixel coordinate matrix. The second column data corresponding to the second column order is determined in the pixel scrambling matrix, and the position to the right of the second column data is determined as the position of the column to be inserted.
[0062] Specifically, for the fourth row data with a row order of 4 in the pixel scrambling matrix traversed in this embodiment, if it is determined that the fourth row data is an even row, then the position directly below the fourth row data is determined as the position of the row to be inserted.
[0063] Specifically, for the fifth row data with a row order of 5 in the pixel scrambling matrix traversed in this embodiment, if it is determined that the fifth row data is an odd row, then the third-largest sorting is determined among the respective second-size sortings of the first row data in the pixel coordinate matrix. This cycle continues until each row data in the pixel scrambling matrix is traversed, and all the positions of the columns to be inserted and the positions of the rows to be inserted are determined.
[0064] Optionally, the above-mentioned pixel diffusion of the pixel scrambling matrix according to the one-dimensional chaotic mapping, all the positions of the columns to be inserted and the positions of the rows to be inserted to obtain the pixel diffusion matrix includes: According to the order obtained by the sequence of all the positions of the columns to be inserted and the positions of the rows to be inserted, blank columns or blank rows are inserted into the pixel scrambling matrix. Before each next insertion operation, a plurality of new chaotic elements are sequentially generated based on the first chaotic mapping and sequentially written into the inserted blank columns or blank rows to obtain the pixel diffusion matrix.
[0065] Specifically, during the process of insertion and writing operations in the pixel scrambling matrix in this embodiment, a first blank column can be inserted at the determined position of the first column to be inserted first. A plurality of new chaotic elements are sequentially generated based on the first chaotic mapping and sequentially written into the first blank column. Then, a first blank row is inserted at the determined position of the first row to be inserted. A plurality of new chaotic elements are sequentially generated based on the first chaotic mapping and sequentially written into the first blank row. Then, a second blank column is inserted at the determined position of the second column to be inserted. A plurality of new chaotic elements are sequentially generated based on the first chaotic mapping and sequentially written into the second blank column. Then, a second blank row is inserted at the determined position of the second row to be inserted. A plurality of new chaotic elements are sequentially generated based on the first chaotic mapping and sequentially written into the second blank row. This continues until all insertion and writing operations are completed, that is, pixel diffusion is completed to obtain the pixel diffusion matrix.
[0066] As Figure 6 shown, this embodiment demonstrates a pixel diffusion process different from the aforementioned pixel diffusion method. In this process, each time a position of a column or row to be inserted is determined, corresponding column insertion or row insertion is performed, and chaotic elements are written. However, the final result obtained by this pixel diffusion process is the same as that of the aforementioned pixel diffusion method. As Figure 6 shown, the confused 6×6 pixel matrix is expanded to a 9×9 matrix. For odd rows, columns are added; for even rows, rows are added. When adding columns, the position of the new column is determined according to the randomly generated coordinate values in the odd rows. When adding rows, new rows are directly inserted below the even rows. This method effectively breaks the arrangement structure between pixels, enhances the diffusion effect of the image, and thus improves the overall encryption strength.
[0067] Optionally, step S1063 includes: Generating a target chaotic matrix based on a one-dimensional chaotic map, the total number of rows and columns in the pixel diffusion matrix; wherein, the total number of rows and columns in the target chaotic matrix are respectively equal to the total number of rows and columns in the pixel diffusion matrix; Performing an exclusive OR operation on each group of elements with corresponding distribution positions in the pixel diffusion matrix and the target chaotic matrix to obtain a first XORed matrix; For any row data in the first XORed matrix, starting from the second element in the row data, performing an exclusive OR operation on the current element and the previous element, obtaining an operation result and replacing the current element until the exclusive OR operation is performed on the last element in the row data and the replacement is completed; Taking the matrix obtained after all replacement processes as the pixel replacement matrix.
[0068] Specifically, in this embodiment, each pixel value in the pixel diffusion matrix can be replaced without an obvious pattern. First, in this embodiment, a chaotic matrix with the same number of rows and columns as the pixel diffusion matrix can be generated based on a one-dimensional chaotic map, and after magnifying the absolute value in the chaotic matrix by 100 times and taking the integer, an integer - taken chaotic matrix is obtained. Subsequently, an exclusive OR operation is performed on the pixel diffusion matrix and the integer - taken chaotic matrix, and a self - feedback exclusive OR operation is further performed with the previous pixel. The pixel replacement algorithm is as shown in the following formula:
[0069]
[0070] Wherein, is the integer - taken chaotic matrix, is the chaotic matrix. is the ceiling operator. is the pixel replacement matrix. is the pixel diffusion matrix. is the pixel matrix of the previous replacement.
[0071] The pixel replacement algorithm adopted in this embodiment completely changes the global pixel values of the image by introducing a chaotic sequence and a self-feedback exclusive-or operation, effectively enhancing the complexity and anti-attack ability of image encryption, and ensuring the high randomness and unpredictability of pixel values.
[0072] It should be noted that this embodiment can implement the confusion and diffusion operations on the pixels of the image to be encrypted. Pixel confusion completely changes the pixel arrangement of the original image and breaks the correlation between adjacent pixels. Pixel diffusion further enhances the anti-attack ability of the system. The pixel replacement part adopts a self-feedback replacement mechanism, enabling the pixel values to be completely updated and ensuring the high randomness and security of encryption.
[0073] The image encryption method based on chaotic mapping proposed in this embodiment can perform pixel confusion, pixel diffusion, and pixel replacement on the pixel matrix corresponding to the image to be encrypted based on the pixel coordinate matrix, effectively implementing image encryption while enhancing the security of the encrypted image data.
[0074] Based on Figure 1 , this embodiment proposes a third image encryption method based on chaotic mapping. After step S106, it may further include: Sending the image encryption data and the key to the target device, so that the target device decrypts the image encryption data based on the key and the saved one-dimensional chaotic mapping to obtain the target image corresponding to the image to be encrypted.
[0075] In the development of marine resources, the underwater wireless sensor network based on the underwater acoustic channel plays an increasingly important role in monitoring the marine environment and the operating status of underwater production systems, such as underwater oil and gas leakage monitoring, underwater umbilical cable surface monitoring, etc. However, the open and shared nature of the underwater acoustic channel makes it vulnerable to network attacks. The image encryption algorithms in related technologies have high computational overhead and are not suitable for the nodes of underwater wireless sensor networks powered by batteries and with limited resources.
[0076] Encryption systems based on chaos theory have characteristics such as unpredictability, randomness, and high sensitivity to initial states and control parameters, and have achieved good application effects in image encryption. Implementing image encryption by introducing chaos theory is an effective encryption method. According to the number of variables in the chaos system, it is divided into one-dimensional chaos mapping and multi-dimensional chaos mapping. One-dimensional chaos mapping has a simple structure, small computational amount, and fast program running speed. However, one-dimensional chaos mapping has deficiencies such as a narrow chaos range and low sensitivity to initial values. Although multi-dimensional chaos mapping has improved in terms of security performance compared to one-dimensional chaos mapping, the program running time is longer and the real-time performance is poor. Therefore, there is an urgent need for a fast and highly secure chaos system to achieve a better encryption scheme. The chaos encryption algorithms in related technologies have defects such as cumbersome encryption processes, slow encryption and decryption speeds, and easy predictability.
[0077] This embodiment can perform image encryption based on an improved one-dimensional chaos mapping and can be applied to encryption during the transmission of images for monitoring the operating state of underwater production systems. To evaluate the encryption effect of this embodiment for image encryption based on one-dimensional chaos mapping, the following analysis is carried out: 1. Analysis of the bifurcation diagram of the new chaos mapping: The bifurcation diagram of a chaos system is an important tool for evaluating chaotic behavior and can reflect the dynamic characteristics of the system under different parameter conditions. Based on the bifurcation diagrams of the sine mapping and the classical logistic mapping, it can be seen that the control parameter range of the chaos mapping is narrow, the number of periodic windows is large, and the randomness is poor. On the contrary, the 1D-SLS mapping has better chaotic characteristics. Through comparative experiments, it is clearly found that the 1D-SLS mapping has a larger control parameter range and better randomness compared to the sine mapping and the logistic mapping, and there are no periodic windows.
[0078] 2. Analysis of the trajectory and phase space of the new chaos mapping: The dimension of the phase space corresponds to the state variables in the system. Below, by analyzing the trajectory of the chaos system in the phase space, the periodicity, randomness, and complexity of the system are evaluated. By comparing the phase space diagrams of the sine mapping and the classical Logistic mapping with the phase space diagram of the 1D-SLS mapping, it is found through comparing the trajectories in the phase space that the 1D-SLS mapping is evenly distributed throughout the phase space and has strong randomness, while the outputs of the sine mapping and the logistic mapping are limited to a finite range. The results prove that the performance of the proposed 1D-SLS mapping has been greatly improved.
[0079] 3. Sensitivity Analysis of the New Chaotic Map: The sensitivity of a chaotic map refers to the degree of difference in its chaotic behavior when there are slight changes in the initial value or control parameters. The higher the sensitivity, the better the performance of the chaotic map. By analyzing two sequences with slightly different initial values, the iterative trajectories of these two chaotic sequences were obtained. Meanwhile, a difference map between the two sequences was generated. Based on the iterative trajectories and the difference map, it can be determined that compared with the sine map and the logistic map, after several iterations, the two sequences generated by the 1D-SLS map are quickly and completely separated, showing a higher sensitivity to the initial value.
[0080] 4. Key Sensitivity of the Underwater Image Encryption Scheme: Even a slight change in the key will lead to significantly different encryption / decryption results. To evaluate the key sensitivity of the proposed scheme in this paper, a slight perturbation was introduced to the system parameters and the initial value respectively , and the encryption / decryption experiment was carried out using the color image of the submarine pipeline. The results show that any slight change in the key will generate completely different ciphertexts, and only the completely correct key can restore the original image, proving that the proposed scheme has extremely high key sensitivity.
[0081] 5. Analysis of Pixel Correlation in the Underwater Image Encryption Scheme: In this embodiment, the pixel correlation of different underwater pipeline color images in different directions was determined. The results show that the adjacent pixels of the plaintext image have high correlations in the horizontal, vertical, and diagonal directions. However, for the ciphertext image encrypted by the 1D-SLS image encryption algorithm, the correlations of its adjacent pixels in all directions are significantly reduced. The test data of different images were determined. The results show that the correlation coefficient of the adjacent pixels of the plaintext image is close to 1, indicating a strong correlation; while the correlation coefficient of the adjacent pixels of the ciphertext image is close to 0, showing a weak correlation. This shows that the 1D-SLS encryption scheme proposed in this embodiment effectively breaks the distribution of adjacent pixels in the plaintext image, significantly improving the security of the image during transmission.
[0082] 6. Analysis of Resistance to Cropping Attacks in the Underwater Image Encryption Scheme: To test the ability of the algorithm to resist cropping attacks, in this embodiment, the ciphertext image during transmission was cropped. The normal ciphertext image and the ciphertext images cropped by 1 / 8, 1 / 4, and 1 / 2 were determined. The decrypted image under normal conditions and the decrypted images under cropping attacks of the encryption algorithm were determined. The experimental results show that even if half of the ciphertext image is subjected to a cropping attack, the main contour of the plaintext image can still be recognized, indicating that the image encryption algorithm in this embodiment has strong robustness against cropping attacks.
[0083] The chaotic encryption algorithm proposed in this embodiment makes the underwater image encryption and decryption process faster, has a wider key space, and stronger randomness. It can effectively resist brute-force exhaustive attacks, differential attacks, noise attacks, and cropping attacks, protecting the data transmitted underwater from being intercepted and attacked, thereby improving the quality of underwater image transmission.
[0084] In this embodiment, a one-dimensional chaotic map 1D - SLS is designed. Tests show that it has a large chaotic range, high sensitivity, and strong randomness. Based on 1D - SLS, an underwater image encryption scheme is proposed. Chaotic sequences are used to generate random pixel coordinates, and pixel confusion and diffusion are realized in a single round, breaking the association between adjacent pixels. Then, the ciphertext is generated by replacing with self-feedback values, changing the global pixel values, and improving the encryption speed and efficiency. This chaotic encryption algorithm has fast encryption and decryption, a wide key space, and strong randomness. It can effectively resist various attacks and improve the quality of underwater image transmission. The open and shared characteristics of the underwater acoustic channel make it vulnerable to network attacks. The encryption schemes of related technologies are complex, and this algorithm successfully solves the problem of fast and efficient encryption.
[0085] As Figure 7 shown, this embodiment proposes an image encryption device based on a chaotic map. The device may include: A first generation unit 701, configured to generate a chaotic sequence including a plurality of chaotic elements based on a set key, a well-established one-dimensional chaotic map, and the total number of pixel points in the image to be encrypted; wherein, the total number of elements in the chaotic sequence is equal to the total number of pixel points; A second generation unit 702, configured to arrange a plurality of chaotic elements in the chaotic sequence according to the total number of pixel rows and the total number of pixel columns in the image to be encrypted, and a set element arrangement order, to generate a chaotic matrix; wherein, the total number of rows and the total number of columns in the chaotic matrix are respectively equal to the total number of pixel rows and the total number of pixel columns; A sorting determination unit 703, configured to respectively determine the first size sorting of each chaotic element in the corresponding row data and the second size sorting of each chaotic element in the corresponding column data in the chaotic matrix; A sorting combination unit 704, configured to respectively combine the first size sorting and the second size sorting of each chaotic element to obtain the coordinate data of each chaotic element; A third generation unit 705, configured to respectively arrange the coordinate data of each chaotic element based on the distribution position of each chaotic element in the chaotic matrix to generate a corresponding matrix as the pixel coordinate matrix; wherein, the distribution position of any chaotic element in the chaotic matrix corresponds to the distribution position of the coordinate data of the chaotic element in the pixel coordinate matrix; An image encryption unit 706, configured to perform pixel encryption on the image to be encrypted based on the pixel coordinate matrix to obtain image encryption data.
[0086] It should be noted that the processing procedures and the beneficial effects brought by the first generation unit 701, the second generation unit 702, the sorting determination unit 703, the sorting combination unit 704, the third generation unit 705, and the image encryption unit 706 can be respectively referred to Figure 1 Steps S101 to S106 in
[0087] Optionally, the image encryption unit 706 is further configured to: Based on the pixel coordinate matrix, perform pixel scrambling in the pixel matrix corresponding to the image to be encrypted to obtain a pixel scrambling matrix; According to the one-dimensional chaotic mapping and the pixel coordinate matrix, perform pixel diffusion on the pixel scrambling matrix to obtain a pixel diffusion matrix; Based on the one-dimensional chaotic mapping, perform pixel substitution on the pixel diffusion matrix to obtain a pixel substitution matrix, which is used as the image encryption data.
[0088] Optionally, the image encryption unit 706 is further configured to: For the first element in the first row and the first column of the pixel matrix, according to the row order and column order of the first element in the pixel matrix, determine the corresponding first coordinate data among the coordinate data of the pixel coordinate matrix, use the first size sorting and the second size sorting in the first coordinate data as the target row order and the target column order respectively, according to the target row order and the target column order, determine the corresponding second coordinate data in the pixel coordinate matrix, and search for the target element corresponding to the position in the pixel matrix, swap the first coordinate data and the second coordinate data in the pixel coordinate matrix to obtain a new pixel coordinate matrix, and swap the first element and the target element in the pixel matrix to obtain a new pixel matrix; For the second element in the first row and the second column of the new pixel matrix, according to the row order and column order of the second element in the new pixel matrix, determine the corresponding coordinate data among the coordinate data of the new pixel coordinate matrix until the swapping of the elements in the last row and the last column is completed, to obtain the latest pixel matrix, which is used as the pixel scrambling matrix.
[0089] Optionally, the total number of rows and the total number of columns in the pixel coordinate matrix are respectively equal to the total number of rows and the total number of columns in the pixel scrambling matrix; the image encryption unit 706 is further configured to: Traverse each row data in the pixel scrambling matrix in ascending order of row order; For the row data with row order N in the pixel confusion matrix traversed, if N is odd, determine the Nth largest sort among the respective second-sized sorts of the first row data in the pixel coordinate matrix, determine the combined data including the Nth largest sort in the pixel coordinate matrix as the target combined data, determine the target column order where the target combined data is located in the pixel coordinate matrix, determine the target column data corresponding to the target column order in the pixel confusion matrix, and determine the position to the right of the first column data as the column position to be inserted; If N is even, determine the position below the row data with row order N in the pixel confusion matrix as the row position to be inserted; According to the one-dimensional chaotic mapping, all the column positions to be inserted, and the row positions to be inserted, perform pixel diffusion on the pixel confusion matrix to obtain the pixel diffusion matrix.
[0090] Optionally, the image encryption unit 706 is further configured to: In the order of all the column positions to be inserted and the row positions to be inserted, insert blank columns or blank rows in the pixel confusion matrix, and before each next insertion operation, sequentially generate a plurality of new chaotic elements based on the first chaotic mapping and sequentially write them into the inserted blank columns or blank rows to obtain the pixel diffusion matrix.
[0091] Optionally, the image encryption unit 706 is further configured to: Generate a target chaotic matrix based on the one-dimensional chaotic mapping, the total number of rows and columns in the pixel diffusion matrix; wherein, the total number of rows and columns in the target chaotic matrix is respectively equal to the total number of rows and columns in the pixel diffusion matrix; Perform an exclusive OR operation on each group of elements with corresponding distribution positions in the pixel diffusion matrix and the target chaotic matrix to obtain the first exclusive OR matrix; For any row data in the first exclusive OR matrix, starting from the second element in the row data, perform an exclusive OR operation on the current element and the previous element to obtain the operation result and replace the current element until the exclusive OR operation on the last element in the row data is completed and the replacement is finished; Use the matrix obtained after all replacement processes as the pixel replacement matrix.
[0092] Optionally, the one-dimensional chaotic mapping is generated by combining a sine mapping, a logic mapping, and a non-linear function.
[0093] Optionally, the above device further includes: A decryption unit, configured to send the image encryption data and the key to a target device after obtaining the image encryption data, so that the target device decrypts the image encryption data based on the key and the saved one-dimensional chaotic map to obtain a target image corresponding to the image to be encrypted.
[0094] For the image encryption device based on chaotic map proposed in this embodiment, the image encryption method has unpredictability and randomness, effectively enhancing the security of the image encryption data.
[0095] The image encryption device based on chaotic map in this embodiment is presented in the form of functional units. Here, the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and a memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0096] An embodiment of the present invention further provides a computer device having the above Figure 7 shown image encryption device based on chaotic map.
[0097] Please refer to Figure 8 , a schematic structural diagram of a computer device provided by an alternative embodiment of the present invention. The computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including a high-speed interface and a low-speed interface. Each component communicates with each other using different buses and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed within the computer device, including instructions stored in the memory or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some alternative embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (such as an array of servers, a set of blade servers, or a multi-processor system). Figure 8 Taking one processor 10 as an example in
[0098] The processor 10 can be a central processor, a network processor, or a combination thereof. Among them, the processor 10 can further include a hardware chip. The above hardware chip can be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The above programmable logic device can be a complex programmable logic device, a field programmable gate array, a general array logic, or any combination thereof.
[0099] Among them, the memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0100] The memory 20 may include a program storage area and a data storage area. The program storage area may store an operating system and application programs required for at least one function. The data storage area may store data created according to the use of the computer device and the like. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some alternative embodiments, the memory 20 may optionally include a memory remotely disposed relative to the processor 10, and these remote memories may be connected to the computer device through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0101] The memory 20 may include a volatile memory, such as a random access memory. The memory may also include a non-volatile memory, such as a flash memory, a hard disk, or a solid-state drive. The memory 20 may also include a combination of the above types of memories.
[0102] The computer device further includes a communication interface 30 for communicating the computer device with other devices or communication networks.
[0103] The embodiments of the present invention also provide a computer-readable storage medium. The methods according to the embodiments of the present invention may be implemented in hardware, firmware, or be implemented as computer code that can be recorded on a storage medium, or be implemented as computer code that is originally stored in a remote storage medium or a non-transitory machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the methods described herein can be stored as such software processes on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium may be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid-state drive, etc.; further, the storage medium may also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code, and when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the methods shown in the above embodiments are implemented.
[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An image encryption method based on chaotic mapping, characterized in that, Including: Generating a chaotic sequence including a plurality of chaotic elements based on a set key, a well - established one - dimensional chaotic map, and the total number of pixel points in the image to be encrypted, wherein the total number of elements in the chaotic sequence is equal to the total number of pixel points; Arranging the plurality of chaotic elements in the chaotic sequence according to the total number of pixel rows and the total number of pixel columns in the image to be encrypted, and a set element arrangement order, to generate a chaotic matrix; wherein the total number of rows and the total number of columns in the chaotic matrix are respectively equal to the total number of pixel rows and the total number of pixel columns; In the chaotic matrix, respectively determining a first size sorting of each chaotic element in the corresponding row data and a second size sorting of each chaotic element in the corresponding column data, and respectively combining the first size sorting and the second size sorting of each chaotic element to obtain coordinate data of each chaotic element; Respectively arranging the coordinate data of each chaotic element based on the distribution position of each chaotic element in the chaotic matrix to generate a corresponding matrix as a pixel coordinate matrix; wherein the distribution position of any chaotic element in the chaotic matrix corresponds to the distribution position of the coordinate data of the chaotic element in the pixel coordinate matrix; Performing pixel encryption on the image to be encrypted based on the pixel coordinate matrix to obtain image encryption data.
2. The method according to claim 1, characterized in that, The performing pixel encryption on the image to be encrypted based on the pixel coordinate matrix to obtain image encryption data includes: Based on the pixel coordinate matrix, performing pixel confusion in the pixel matrix corresponding to the image to be encrypted to obtain a pixel confusion matrix; According to the one - dimensional chaotic map and the pixel coordinate matrix, performing pixel diffusion on the pixel confusion matrix to obtain a pixel diffusion matrix; Performing pixel substitution on the pixel diffusion matrix based on the one - dimensional chaotic map to obtain a pixel substitution matrix as the image encryption data.
3. The method according to claim 2, wherein The performing pixel confusion in the pixel matrix corresponding to the image to be encrypted based on the pixel coordinate matrix to obtain a pixel confusion matrix includes: For the first element in the first row and the first column of the pixel matrix, according to the row order and column order of the first element in the pixel matrix, determining in each of the coordinate data of the pixel coordinate matrix the corresponding first coordinate data, taking the first size sorting and the second size sorting in the first coordinate data as the target row order and the target column order respectively, according to the target row order and the target column order, determining in the pixel coordinate matrix the corresponding second coordinate data, and searching for the target element corresponding to the position in the pixel matrix, swapping the first coordinate data and the second coordinate data in the pixel coordinate matrix to obtain a new pixel coordinate matrix, and swapping the first element and the target element in the pixel matrix to obtain a new pixel matrix; For the second element in the first row and the second column of the new pixel matrix, according to the row order and column order of the second element in the new pixel matrix, in each of the coordinate data of the new pixel coordinate matrix, determine the corresponding coordinate data at the position until the swapping of the elements in the last row and the last column is completed, to obtain the latest pixel matrix, and use it as the pixel scrambling matrix.
4. The method according to claim 2, characterized in that The total number of rows and the total number of columns in the pixel coordinate matrix are respectively equal to the total number of rows and the total number of columns in the pixel scrambling matrix; Performing pixel diffusion on the pixel scrambling matrix according to the one-dimensional chaotic mapping and the pixel coordinate matrix to obtain a pixel diffusion matrix, including: Traverse each row data in the pixel scrambling matrix in ascending order of row order; For the row data with row order N in the pixel scrambling matrix traversed, if N is odd, determine the Nth largest sorting among the second-size sortings of each data in the first row data of the pixel coordinate matrix, determine the combined data including the Nth largest sorting in the pixel coordinate matrix as the target combined data, and determine the target column order of the target combined data in the pixel coordinate matrix, determine the target column data corresponding to the target column order in the pixel scrambling matrix, and determine the position on the right side of the first column data as the column position to be inserted; If N is even, determine the position below the row data with row order N in the pixel scrambling matrix as the row position to be inserted; Perform pixel diffusion on the pixel scrambling matrix according to the one-dimensional chaotic mapping, all the column positions to be inserted, and the row positions to be inserted to obtain the pixel diffusion matrix.
5. The method according to claim 4, wherein Performing pixel diffusion on the pixel scrambling matrix according to the one-dimensional chaotic mapping, all the column positions to be inserted, and the row positions to be inserted to obtain the pixel diffusion matrix, including: Insert blank columns or blank rows in the pixel scrambling matrix in the order of the column positions to be inserted and the row positions to be inserted, and before each next insertion operation, generate a new plurality of chaotic elements in sequence based on the first chaotic mapping and write them into the inserted blank columns or blank rows in sequence to obtain the pixel diffusion matrix.
6. The method according to claim 2, wherein Performing pixel replacement on the pixel diffusion matrix based on the one-dimensional chaotic mapping to obtain a pixel replacement matrix, including: Generate a target chaotic matrix based on the one-dimensional chaotic mapping, the total number of rows and the total number of columns in the pixel diffusion matrix; wherein, the total number of rows and the total number of columns in the target chaotic matrix are respectively equal to the total number of rows and the total number of columns in the pixel diffusion matrix; Perform an exclusive OR operation on each group of elements with corresponding distribution positions in the pixel diffusion matrix and the target chaotic matrix to obtain a first exclusive OR matrix; For any row data in the first exclusive OR matrix, starting from the second element in the row data, perform an exclusive OR operation on the current element and the previous element to obtain an operation result and replace the current element until the exclusive OR operation on the last element in the row data is completed and the replacement is finished; The matrix obtained after completing all replacement processes is used as the pixel replacement matrix.
7. The method according to any one of claims 1 to 6, characterized in that, The one-dimensional chaotic map is generated by combining a sine map, a logistic map, and a non-linear function.
8. The method according to any one of claims 1 to 6, characterized in that After obtaining the image encryption data, the method further includes: Sending the image encryption data and the key to a target device, so that the target device decrypts the image encryption data based on the key and the stored one-dimensional chaotic map to obtain a target image corresponding to the image to be encrypted.
9. An image encryption device based on chaotic mapping, characterized in that, It includes: A first generation unit, configured to generate a chaotic sequence including a plurality of chaotic elements based on a set key, a well-established one-dimensional chaotic map, and the total number of pixel points in the image to be encrypted; wherein, the total number of elements in the chaotic sequence is equal to the total number of pixel points; A second generation unit, configured to arrange the plurality of chaotic elements in the chaotic sequence according to the total number of pixel rows and the total number of pixel columns in the image to be encrypted, and a set element arrangement order, to generate a chaotic matrix; wherein, the total number of rows and the total number of columns in the chaotic matrix are respectively equal to the total number of pixel rows and the total number of pixel columns; A sorting determination unit, configured to respectively determine a first size sorting of each chaotic element in the corresponding row data and a second size sorting of each chaotic element in the corresponding column data in the chaotic matrix; A sorting combination unit, configured to respectively combine the first size sorting and the second size sorting of each chaotic element to obtain coordinate data of each chaotic element; A third generation unit, configured to respectively arrange the coordinate data of each chaotic element based on the distribution position of each chaotic element in the chaotic matrix to generate a corresponding matrix and use it as a pixel coordinate matrix; wherein, the distribution position of any chaotic element in the chaotic matrix corresponds to the distribution position of the coordinate data of the chaotic element in the pixel coordinate matrix; An image encryption unit, configured to perform pixel encryption on the image to be encrypted based on the pixel coordinate matrix to obtain image encryption data.
10. A computer device, characterized in that, It includes: A memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to execute the image encryption method based on chaotic mapping according to any one of claims 1 to 8.