An image encryption method and related device
By using chaotic technology based on lattice model, amplitude value encryption algorithm and propulsion encryption algorithm in image encryption, multi-level encryption processing is performed on the image, which solves the problem that traditional image encryption methods are easily cracked, and efficient image information security is achieved.
Patent Information
- Application Number
- CN202210355577.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-06
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2042-04-06
AI Technical Summary
Because the traditional image encryption method depends on the high degree of correlation between image pixels, the encrypted image is easily cracked and cannot effectively ensure the security of the image information.
The chaotic technology based on the lattice model, amplitude value encryption algorithm and propulsion encryption algorithm are used to perform multi-level encryption processing on the image. The specific steps include: obtaining the grayscale matrix of the image, using the chaotic key to perform chaotic processing, dividing the image into sub-images, applying amplitude encryption algorithm and a propulsion encryption algorithm for encryption processing, and generating the final encrypted image through the exclusive or sum merge operation.
By performing multi-level encryption on the image, the correlation between pixels in the encrypted image is reduced, making the encrypted image difficult to be cracked by attacks, effectively ensuring the security of the image information.
Smart Images

Figure CN114710260B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technologies, and in particular, to an image encryption method and related devices. Background Art
[0002] In the Internet era, compared with ordinary text information, images have characteristics such as high redundancy, large data volume, and strong correlation between pixels. Therefore, the information security of images is particularly important.
[0003] Currently, a large number of images are often transmitted on the network. To protect the information security in the images, it is usually necessary to encrypt the images. However, the traditional image encryption methods rely on a high degree of correlation between image pixels, resulting in the encrypted images being relatively easy to be cracked, causing information leakage of the images and making it difficult to ensure the information security of the images. Summary of the Invention
[0004] In view of the above problems, the present disclosure provides an image encryption method and related devices that overcome the above problems or at least partially solve the above problems. The technical solutions are as follows:
[0005] An image encryption method includes:
[0006] Obtaining a first grayscale matrix corresponding to an unencrypted first image, where the first grayscale matrix is composed of grayscale values of each pixel point in the first image;
[0007] Obtaining encryption parameters input by a user, where the encryption parameters include a chaotic key;
[0008] Based on a lattice model, using the chaotic key to perform chaotic processing on the first grayscale matrix to obtain a first chaotic matrix;
[0009] Dividing the first image into a first sub-image and a second sub-image, where the first sub-image corresponds to a first grayscale sub-matrix in the first grayscale matrix, and the second sub-image corresponds to a second grayscale sub-matrix in the first grayscale matrix;
[0010] Using an amplitude value encryption algorithm to perform amplitude encryption processing on the first grayscale matrix to obtain a second grayscale matrix, where the first grayscale sub-matrix corresponds to a third grayscale sub-matrix in the second grayscale matrix, and the second grayscale sub-matrix corresponds to a fourth grayscale sub-matrix in the second grayscale matrix;
[0011] Based on a push-type encryption algorithm, using the first chaotic matrix to encrypt the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix;
[0012] Performing an exclusive OR operation on the fifth grayscale sub-matrix and the third grayscale sub-matrix to obtain a sixth grayscale sub-matrix;
[0013] Merge the sixth grayscale sub-matrix with the fourth grayscale sub-matrix to obtain the encrypted second image.
[0014] Optionally, the chaotic key includes a first key and a second key. Based on the lattice model, using the chaotic key to perform chaotic processing on the first grayscale matrix to obtain a first chaotic matrix, including:
[0015] Based on the lattice model, use the first key and the second key to perform Chebyshev mapping on the first grayscale matrix in sequence to obtain a second chaotic matrix;
[0016] Perform unidirectional coupled chaotic processing on the second chaotic matrix to obtain a third chaotic matrix;
[0017] Perform bidirectional coupled chaotic processing on the third chaotic matrix to obtain a fourth chaotic matrix;
[0018] Perform integer data processing on the fourth chaotic matrix to obtain a first chaotic matrix.
[0019] Optionally, using the amplitude value encryption algorithm to perform amplitude encryption processing on the first grayscale matrix to obtain a second grayscale matrix, including:
[0020] Perform a fast Fourier transform on the first grayscale matrix to obtain a first amplitude spectrum matrix;
[0021] Perform amplitude attenuation processing on the first amplitude spectrum matrix to obtain a second amplitude spectrum matrix, where the first amplitude spectrum sub-matrix in the second amplitude spectrum matrix corresponds to the first grayscale sub-matrix, and the second amplitude spectrum sub-matrix in the second amplitude spectrum matrix corresponds to the second grayscale sub-matrix;
[0022] Perform an exclusive OR operation on the first amplitude spectrum sub-matrix and the first grayscale sub-matrix, and perform an exclusive OR operation on the second amplitude spectrum sub-matrix and the second grayscale sub-matrix to obtain a third amplitude spectrum matrix;
[0023] Perform an inverse fast Fourier transform on the third amplitude spectrum matrix to obtain a second grayscale matrix.
[0024] Optionally, based on the push-type encryption algorithm, using the first chaotic matrix to perform encryption processing on the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix, including:
[0025] Process the first chaotic matrix according to a preset chaotic value preprocessing algorithm to obtain a fifth chaotic matrix;
[0026] Based on a propulsion encryption algorithm, use the chaotic values in the fifth chaotic matrix as the third key to encrypt the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix.
[0027] Optionally, the step of merging the sixth grayscale sub-matrix and the fourth grayscale sub-matrix to obtain the encrypted second image includes:
[0028] Swap the positions of the sixth grayscale sub-matrix and the fourth grayscale sub-matrix and splice them to obtain the encrypted second image, where the position of the fourth grayscale sub-matrix in the second image is the same as the corresponding position of the first grayscale sub-matrix in the first image, and the position of the sixth grayscale sub-matrix in the second image is the same as the corresponding position of the second grayscale sub-matrix in the first image.
[0029] Optionally, the encryption parameter further includes the number of encryption rounds. After obtaining the encrypted second image, the method further includes:
[0030] Increment the encryption count of the first image by 1;
[0031] When the encryption count does not exceed the number of encryption rounds, use the second image as the first image, use the third grayscale matrix corresponding to the second image as the first grayscale matrix, and return to execute the step of performing chaotic processing on the first grayscale matrix using the chaotic key based on the lattice model to obtain the first chaotic matrix.
[0032] Optionally, after obtaining the encrypted second image, the method further includes:
[0033] Compare and analyze the first image and the second image according to a preset encryption effect analysis algorithm to obtain an image encryption analysis result.
[0034] An image encryption device includes: a first obtaining unit, a second obtaining unit, a third obtaining unit, a first partitioning unit, a first encryption unit, a second encryption unit, a fourth obtaining unit, and a fifth obtaining unit.
[0035] The first obtaining unit is configured to obtain a first grayscale matrix corresponding to an unencrypted first image, where the first grayscale matrix is composed of the grayscale values of each pixel point in the first image.
[0036] The second obtaining unit is configured to obtain encryption parameters input by a user, where the encryption parameters include a chaotic key.
[0037] The third obtaining unit is configured to perform chaotic processing on the first grayscale matrix using the chaotic key based on a lattice model to obtain a first chaotic matrix.
[0038] The first division unit is configured to divide the first image into a first sub-image and a second sub-image, wherein the first sub-image corresponds to a first gray-scale sub-matrix in the first gray-scale matrix, and the second sub-image corresponds to a second gray-scale sub-matrix in the first gray-scale matrix;
[0039] The first encryption unit is configured to perform amplitude encryption processing on the first gray-scale matrix by using an amplitude value encryption algorithm to obtain a second gray-scale matrix, wherein the first gray-scale sub-matrix corresponds to a third gray-scale sub-matrix in the second gray-scale matrix, and the second gray-scale sub-matrix corresponds to a fourth gray-scale sub-matrix in the second gray-scale matrix;
[0040] The second encryption unit is configured to perform encryption processing on the fourth gray-scale sub-matrix by using the first chaotic matrix based on a push-type encryption algorithm to obtain a fifth gray-scale sub-matrix;
[0041] The fourth obtaining unit is configured to perform an exclusive OR operation on the fifth gray-scale sub-matrix and the third gray-scale sub-matrix to obtain a sixth gray-scale sub-matrix;
[0042] The fifth obtaining unit is configured to merge the sixth gray-scale sub-matrix and the fourth gray-scale sub-matrix to obtain an encrypted second image.
[0043] A computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the image encryption method described in any one of the above is implemented.
[0044] An electronic device, the electronic device includes at least one processor, and at least one memory and a bus connected to the processor; wherein, the processor and the memory complete communication with each other through the bus; the processor is configured to call program instructions in the memory to execute the image encryption method described in any one of the above.
[0045] By the above technical solution, an image encryption method and related devices provided by the present disclosure can obtain a first grayscale matrix corresponding to an unencrypted first image, where the first grayscale matrix is composed of the grayscale values of each pixel point in the first image; obtain encryption parameters input by a user, where the encryption parameters include a chaotic key; based on a lattice model, use the chaotic key to perform chaotic processing on the first grayscale matrix to obtain a first chaotic matrix; divide the first image into a first sub-image and a second sub-image, where the first sub-image corresponds to a first grayscale sub-matrix in the first grayscale matrix, and the second sub-image corresponds to a second grayscale sub-matrix in the first grayscale matrix; use an amplitude value encryption algorithm to perform amplitude encryption processing on the first grayscale matrix to obtain a second grayscale matrix, where the first grayscale sub-matrix corresponds to a third grayscale sub-matrix in the second grayscale matrix, and the second grayscale sub-matrix corresponds to a fourth grayscale sub-matrix in the second grayscale matrix; based on a push-type encryption algorithm, use the first chaotic matrix to encrypt the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix; perform an exclusive OR operation on the fifth grayscale sub-matrix and the third grayscale sub-matrix to obtain a sixth grayscale sub-matrix; merge the sixth grayscale sub-matrix and the fourth grayscale sub-matrix to obtain an encrypted second image. The present disclosure can use an amplitude value encryption algorithm, a chaotic technology based on a lattice model, and a push-type encryption algorithm to perform encryption operations on images, can effectively scramble the pixel data features in the images, reduce the correlation degree between pixels in the encrypted image, make the encrypted image difficult to be attacked and cracked, and effectively guarantee the information security of the images.
[0046] The above description is only an overview of the technical solution of the present disclosure. In order to be able to understand the technical means of the present disclosure more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present disclosure more obvious and understandable, the following specifically gives the specific implementation manners of the present disclosure. Brief Description of the Drawings
[0047] By reading the detailed description of the preferred embodiments below, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present disclosure. And throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:
[0048] Figure 1 shows a schematic flowchart of an implementation manner of the image encryption method provided by an embodiment of the present disclosure;
[0049] Figure 2 shows a schematic flowchart of a specific implementation manner of step S300 in the image encryption method provided by an embodiment of the present disclosure;
[0050] Figure 3Shows a schematic flowchart of a specific implementation of step S500 in the image encryption method provided by an embodiment of the present disclosure;
[0051] Figure 4 Shows a schematic flowchart of a specific implementation of step S600 in the image encryption method provided by an embodiment of the present disclosure;
[0052] Figure 5 Shows a schematic flowchart of another implementation of the image encryption method provided by an embodiment of the present disclosure;
[0053] Figure 6 Shows a schematic flowchart of another implementation of the image encryption method provided by an embodiment of the present disclosure;
[0054] Figure 7 Shows a schematic flowchart of another implementation of the image encryption method provided by an embodiment of the present disclosure;
[0055] Figure 8 Shows a schematic structural diagram of an image encryption device provided by an embodiment of the present disclosure. Specific implementation
[0056] Hereinafter, the exemplary embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.
[0057] As Figure 1 shown, a schematic flowchart of an implementation of the image encryption method provided by an embodiment of the present disclosure, the image encryption method may include:
[0058] S100. Obtain a first grayscale matrix corresponding to an unencrypted first image, where the first grayscale matrix is composed of grayscale values of each pixel point in the first image.
[0059] Specifically, an embodiment of the present disclosure may obtain the first image and read the grayscale values from the leftmost pixel point of the first row to the rightmost pixel point of the last row of the first image, and sequentially determine the grayscale values corresponding to each pixel point, so as to obtain the first grayscale matrix corresponding to the first image.
[0060] It can be understood that an embodiment of the present disclosure does not limit the size and bit width of the first image.
[0061] S200. Obtain encryption parameters input by a user, where the encryption parameters include a chaotic key.
[0062] Among them, the chaotic key can be a sequence for the lattice chaotic system to iterate. Usually, the initial chaotic key of the lattice chaotic system is provided by the user. Optionally, the chaotic key includes a first key and a second key. For example: the first key can be "X0 = 0.123456789", and the second key can be "X1 = 0.987654321".
[0063] S300. Based on the lattice model, use the chaotic key to perform chaotic processing on the first grayscale matrix to obtain a first chaotic matrix.
[0064] Among them, the implementation form of the lattice model can be a two-dimensional array. The subscript of the second dimension in this two-dimensional array is used to indicate the number of the lattice. gezi[0][0] represents the 0th element of the 0th lattice, and so on. Optionally, the two-dimensional array used in the embodiments of the present disclosure can be gezi
[64]
[8004] . In actual applications, only 61×8001 space sizes are used, and the extra space is to prevent array out-of-bounds problems. The lattice model is used to load the chaotic values generated by the encryption algorithm.
[0065] Optionally, based on Figure 1 the method shown, as Figure 2 shown, the flowchart of a specific implementation manner of step S300 in the image encryption method provided by the embodiments of the present disclosure may include:
[0066] S310. Based on the lattice model, use the first key and the second key in sequence to perform Chebyshev mapping on the first grayscale matrix to obtain a second chaotic matrix.
[0067] Among them, the Chebyshev mapping is consistent with the statistical characteristics of white noise and is suitable as a spreading address code. The chaotic sequence generated by this mapping has an ideal linear complexity and good balance characteristics. The performance of the chaotic sequence based on the Chebyshev mapping is close to that of the Gold code sequence, and it has the advantages of simple generation, a large number of sequences, and good confidentiality. It is an ideal choice to replace traditional spreading codes. The calculation formula of the Chebyshev mapping is: X n+1 = cos(2×arcos(X n ))), X n = [-1, 1].
[0068] Optionally, the embodiments of the present disclosure can first use the first key to perform Chebyshev mapping on the first grayscale matrix to determine the values of some lattices with subscript 0, and then use the second key to perform Chebyshev mapping on the first grayscale matrix to determine the values of another part of the lattices with subscript 0.
[0069] Preferably, in the embodiments of the present disclosure, the first key can be used as the initial input value for performing Chebyshev mapping on the first grayscale matrix. First, iterate 2000 times, and no operation is performed on the iteration results of these 2000 iterations. Starting from the 2001st iteration, for each iteration, if the result of the iteration is any real number from 0 to 1, the result is correspondingly used as the chaotic value with subscript 0 in the 0th grid to the 30th grid. Then, use the second key as the initial input value for performing Chebyshev mapping on the first grayscale matrix to perform the above iteration operation to determine the chaotic value with subscript 0 in the 31st grid to the 60th grid. It can be understood that after obtaining the chaotic values with subscript 0 of each grid in sequence, the second chaotic matrix is obtained.
[0070] S320. Perform one-way coupled chaotic processing on the second chaotic matrix to obtain a third chaotic matrix.
[0071] Optionally, in the embodiments of the present disclosure, a one-way coupled map lattice (OCML) can be used to perform one-way coupled chaotic processing on the second chaotic matrix.
[0072] Optionally, in the embodiments of the present disclosure, the chaotic value with subscript 0 of any grid in the second chaotic matrix can be used as the initial input value of the one-way coupled map lattice chaotic system for iteration in sequence, and the iteration result of each iteration is used as the chaotic value corresponding to that grid, thereby generating a third chaotic matrix. Preferably, taking the 0th grid as an example, the chaotic value with subscript 0 in the 0th grid of the second chaotic matrix is used as the initial input value of the one-way coupled map lattice chaotic system, and 4000 times of one-way coupled chaotic iterations are first performed. The iteration result of each iteration is used as the chaotic value corresponding to the 0th grid. At this time, there are a total of 4001 chaotic values corresponding to subscripts 0 to 4000 of the 0th grid. The other numbered grids are also iterated as described above. Then, there are a total of 61×4001 = 244061 chaotic values in the 61 grids of the third chaotic matrix.
[0073] S330. Perform two-way coupled chaotic processing on the third chaotic matrix to obtain a fourth chaotic matrix.
[0074] Optionally, in the embodiments of the present disclosure, a two-way coupled map lattice (TCML) can be used to perform two-way coupled chaotic processing on the third chaotic matrix to obtain a fourth chaotic matrix.
[0075] Optionally, embodiments of the present disclosure may iteratively use the chaotic value with a subscript of 4000 in any grid of the third chaotic matrix as the initial input value of the bidirectional coupled map lattice system, and use the iterative result of each iteration as the chaotic value corresponding to that grid, thereby generating a fourth chaotic matrix. Preferably, taking the 0th grid as an example, the chaotic value with a subscript of 4000 in the 0th grid of the third chaotic matrix is used as the initial input value of the bidirectional coupled map lattice system, and 4000 times of bidirectional coupled chaotic iteration are performed. The iterative result of each iteration is used as the chaotic value corresponding to the 0th grid. At this time, there are 8001 chaotic values corresponding to the subscripts 0 to 8001 of the 0th grid. The grids with other numbers are also iterated as described above. Then, there are a total of 61×8001 = 488061 chaotic values in the 61 grids of the fourth chaotic matrix.
[0076] S340. Perform integer data processing on the fourth chaotic matrix to obtain a first chaotic matrix.
[0077] Since the chaotic values corresponding to the grids in the fourth chaotic matrix are floating-point data, embodiments of the present disclosure may perform integer data processing on the chaotic values corresponding to the grids in the fourth chaotic matrix to obtain integer chaotic values.
[0078] Optionally, embodiments of the present disclosure may use the last digit after the decimal point of the chaotic value of each floating-point data corresponding to the grids in the fourth chaotic matrix as a new chaotic value, take the remainder of each new chaotic value modulo 256 (i.e., mod 256), and replace the original floating-point chaotic value with the remainder result, so that the chaotic values corresponding to the grids in the first chaotic matrix are integer data restricted between 0 and 256.
[0079] Embodiments of the present disclosure use a lattice model, a Chebyshev map, unidirectional coupled chaos processing, and bidirectional coupled chaos processing to generate chaotic values required for encryption, effectively improving the problem of degradation of chaotic dynamics characteristics when a chaotic system is implemented with finite precision in a computer, enhancing the randomness of chaotic values, and improving the encryption strength of images.
[0080] S400. Divide the first image into a first sub-image and a second sub-image, where the first sub-image corresponds to the first gray sub-matrix in the first gray matrix, and the second sub-image corresponds to the second gray sub-matrix in the first gray matrix.
[0081] Optionally, embodiments of the present disclosure may divide the first image into a first sub-image and a second sub-image with equal size and bit width. For example: assuming that the size and bit width of the first image are "M×N×8bit", then the size and bit width of the first sub-image and the second sub-image may be Optionally, in the embodiments of the present disclosure, the first image may be divided into an equal upper half image and lower half image, the upper half image is used as the first sub-image, and the lower half image is used as the second sub-image.
[0082] It can be understood that while the first image is divided into the first sub-image and the second sub-image, a first gray-scale sub-matrix corresponding to the first sub-image can be determined in the first gray-scale matrix, and a second gray-scale sub-matrix corresponding to the second sub-image can be determined in the first gray-scale matrix.
[0083] S500. Perform amplitude encryption processing on the first gray-scale matrix by using an amplitude value encryption algorithm to obtain a second gray-scale matrix, where the first gray-scale sub-matrix corresponds to a third gray-scale sub-matrix in the second gray-scale matrix, and the second gray-scale sub-matrix corresponds to a fourth gray-scale sub-matrix in the second gray-scale matrix.
[0084] Optionally, based on Figure 1 the method shown, as Figure 3 shown, a schematic flowchart of a specific implementation manner of step S500 in the image encryption method provided by the embodiments of the present disclosure may include:
[0085] S510. Perform a fast Fourier transform on the first gray-scale matrix to obtain a first amplitude spectrum matrix.
[0086] Among them, the fast Fourier transform (FFT) is a fast algorithm for the discrete Fourier transform and can also be used to calculate the inverse transform of the discrete Fourier transform.
[0087] Specifically, in the embodiments of the present disclosure, each gray-scale value in the first gray-scale matrix may be subjected to a fast Fourier transform, and the transformed gray-scale values are saved in a two-dimensional array to generate a first amplitude spectrum matrix.
[0088] S520. Perform amplitude weakening processing on the first amplitude spectrum matrix to obtain a second amplitude spectrum matrix, where a first amplitude spectrum sub-matrix in the second amplitude spectrum matrix corresponds to the first gray-scale sub-matrix, and a second amplitude spectrum sub-matrix in the second amplitude spectrum matrix corresponds to the second gray-scale sub-matrix.
[0089] Specifically, in the embodiments of the present disclosure, each amplitude value in the first amplitude spectrum matrix may be square-rooted twice, and the obtained new amplitude values are used to replace the original amplitude values in the first amplitude spectrum matrix to obtain a second amplitude spectrum matrix.
[0090] It can be understood that based on the manner of dividing the first image into the first sub-image and the second sub-image, a first amplitude spectrum sub-matrix corresponding to the first gray-scale sub-matrix and a second amplitude spectrum sub-matrix corresponding to the second gray-scale sub-matrix can be determined in the second amplitude spectrum matrix.
[0091] S530. Perform an exclusive OR operation on the first amplitude spectrum sub-matrix and the first grayscale sub-matrix, and perform an exclusive OR operation on the second amplitude spectrum sub-matrix and the second grayscale sub-matrix to obtain a third amplitude spectrum matrix.
[0092] Specifically, in the embodiments of the present disclosure, each amplitude value in the first amplitude spectrum sub-matrix can be respectively subjected to an exclusive OR operation with the corresponding grayscale value in the first grayscale sub-matrix, and the results are correspondingly saved. Similarly, in the embodiments of the present disclosure, each amplitude value in the second amplitude spectrum sub-matrix can be respectively subjected to an exclusive OR operation with the corresponding grayscale value in the second grayscale sub-matrix, and the results are correspondingly saved, and finally a third amplitude spectrum matrix is obtained.
[0093] S540. Perform an inverse fast Fourier transform on the third amplitude spectrum matrix to obtain a second grayscale matrix.
[0094] Specifically, in the embodiments of the present disclosure, an inverse fast Fourier transform can be performed on each amplitude value in the third amplitude spectrum matrix, and the transformed amplitude values are correspondingly used to replace the original amplitude values to obtain a second grayscale matrix.
[0095] It can be understood that based on the way of dividing the first image into the first sub-image and the second sub-image, a third grayscale sub-matrix corresponding to the first grayscale sub-matrix can be determined in the second grayscale matrix, and a fourth grayscale sub-matrix corresponding to the second grayscale sub-matrix can be determined in the second grayscale matrix.
[0096] S600. Based on a propelled encryption algorithm, use the first chaotic matrix to encrypt the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix.
[0097] In the embodiments of the present disclosure, based on a propelled encryption algorithm (Propelled Encrypted Algorithm, PEA) under the Feistel encryption structure, the first chaotic matrix can be used to encrypt the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix.
[0098] Among them, the Feistel cipher structure is a symmetric structure used in block ciphers. The Feistel encryption structure can sequentially execute two or more basic cipher systems, so that the cipher strength of the final result is higher than that of each cipher system. A block cipher is a sequence of digital numbers (referred to as plaintext numbers) after encoding the plaintext message, which is divided into groups of length n (which can be regarded as vectors of length n), and each group is transformed into a sequence of equal-length output digital numbers (referred to as ciphertext numbers) under the control of a key.
[0099] Optionally, based on Figure 1 the method shown, such as Figure 4As shown, it is a schematic flowchart of a specific implementation manner of step S600 in the image encryption method provided by an embodiment of the present disclosure. Step S600 may include:
[0100] S610. Process the first chaotic matrix according to a preset chaotic value preprocessing algorithm to obtain a fifth chaotic matrix.
[0101] Specifically, an embodiment of the present disclosure may be based on the formula:
[0102] y n (i)=(y n (i)+y n+1 (i))%256, n = [0, 59]
[0103] y 60 (i)=(y 60 (i)+y0(i))%256
[0104] Process each chaotic value in the first chaotic matrix to obtain a fifth chaotic matrix. Wherein, the subscript of y is the grid number, and i is the amplitude value number.
[0105] S620. Based on a push-type encryption algorithm, use the chaotic values in the fifth chaotic matrix as the third key to encrypt the fourth grayscale submatrix to obtain a fifth grayscale submatrix.
[0106] Optionally, an embodiment of the present disclosure may, based on a push-type encryption algorithm, sequentially use the chaotic values corresponding to each grid in the fifth chaotic matrix as the third key to encrypt the fourth grayscale submatrix to obtain a fifth grayscale submatrix.
[0107] Specifically, an embodiment of the present disclosure may first use the chaotic value with subscript 0 from the 0th grid to the 60th grid in the fifth chaotic matrix as the third key to perform an exclusive OR operation on each grayscale value in the fourth grayscale submatrix. On this basis, then use the chaotic value with subscript 1 from the 0th grid to the 60th grid in the fifth chaotic matrix as the third key to perform another exclusive OR operation, and so on, until the 8001st chaotic value of the 60th grid is used up or a round of encryption of each grayscale value in the fourth grayscale submatrix is completed.
[0108] Based on the fourth grayscale sub-matrix after the above-mentioned round of encryption, in the next round of encryption, the chaotic values with subscript 0 from the 1st cell to the 60th cell in the fifth chaotic matrix are used as the third key, and continue to perform an exclusive OR operation on each grayscale value in the fourth grayscale sub-matrix after the above-mentioned round of encryption. On this basis, then use the chaotic values with subscript 1 from the 1st cell to the 60th cell in the fifth chaotic matrix as the third key to perform another exclusive OR operation, and so on, until the 8001st chaotic value of the 60th cell is used up or a round of encryption is completed for each grayscale value in the fourth grayscale sub-matrix.
[0109] Based on the fourth grayscale sub-matrix after the above-mentioned round of encryption, and so on, each round of encryption uses one less chaotic value corresponding to a cell than the previous round of encryption, realizing a process of progressive encryption.
[0110] The embodiment of the present disclosure encrypts the image through a progressive encryption algorithm based on the Feistel encryption structure, effectively realizing the confusion of image data and further improving the intensity of image encryption.
[0111] S700. Perform an exclusive OR operation on the fifth grayscale sub-matrix and the third grayscale sub-matrix to obtain the sixth grayscale sub-matrix.
[0112] Specifically, the embodiment of the present disclosure can perform an exclusive OR operation on two grayscale values corresponding to the same position in the fifth grayscale sub-matrix and the third grayscale sub-matrix, and determine the value after the exclusive OR operation as the grayscale value corresponding to this position on the sixth grayscale sub-matrix. For example: perform an exclusive OR operation on the grayscale value corresponding to the first pixel point in the upper left corner of the fifth grayscale sub-matrix and the grayscale value corresponding to the first pixel point in the upper left corner of the third grayscale sub-matrix, obtain the grayscale value after the exclusive OR operation, and determine this grayscale value as the grayscale value in the upper left corner of the sixth grayscale sub-matrix.
[0113] S800. Merge the sixth grayscale sub-matrix and the fourth grayscale sub-matrix to obtain the encrypted second image.
[0114] Optionally, the embodiment of the present disclosure can splice the sixth grayscale sub-matrix and the fourth grayscale sub-matrix according to the way of dividing the first image into the first sub-image and the second sub-image to obtain the encrypted second image.
[0115] Optionally, based on Figure 1 the method shown, as Figure 5 shown, a schematic flowchart of a specific implementation manner of step S800 in the image encryption method provided by the embodiment of the present disclosure, step S800 may include:
[0116] S810. Swap and splice the sixth grayscale sub - matrix and the fourth grayscale sub - matrix to obtain the encrypted second image, where the position of the fourth grayscale sub - matrix in the second image is the same as the corresponding position of the first grayscale sub - matrix in the first image, and the position of the sixth grayscale sub - matrix in the second image is the same as the corresponding position of the second grayscale sub - matrix in the first image.
[0117] It can be understood that in the case of dividing the first image into a first sub - image and a second sub - image, after amplitude encryption processing, push - type encryption algorithm encryption processing, and a series of exclusive - OR processing, the first sub - image corresponds to the sixth grayscale sub - matrix, and the second sub - image corresponds to the fourth grayscale sub - matrix. In the embodiments of the present disclosure, by swapping and splicing the sixth grayscale sub - matrix and the fourth grayscale sub - matrix, the positions of the two sub - images of the encrypted second image are swapped relative to the first image. For example, assume that the first sub - image is the upper - half image of the first image, and the second sub - image is the lower - half image of the first image. Then, in the second image, the sixth grayscale sub - matrix corresponding to the first sub - image is the lower - half of the second image, and the fourth grayscale sub - matrix corresponding to the second sub - image is the upper - half of the second image.
[0118] An image encryption method provided by the present disclosure can obtain a first grayscale matrix corresponding to an unencrypted first image, where the first grayscale matrix is composed of the grayscale values of each pixel point in the first image; obtain an encryption parameter input by the user, where the encryption parameter includes a chaotic key; based on a lattice model, use the chaotic key to perform chaotic processing on the first grayscale matrix to obtain a first chaotic matrix; divide the first image into a first sub - image and a second sub - image, where the first sub - image corresponds to a first grayscale sub - matrix in the first grayscale matrix, and the second sub - image corresponds to a second grayscale sub - matrix in the first grayscale matrix; use an amplitude - value encryption algorithm to perform amplitude encryption processing on the first grayscale matrix to obtain a second grayscale matrix, where the first grayscale sub - matrix corresponds to a third grayscale sub - matrix in the second grayscale matrix, and the second grayscale sub - matrix corresponds to a fourth grayscale sub - matrix in the second grayscale matrix; based on a push - type encryption algorithm, use the first chaotic matrix to encrypt the fourth grayscale sub - matrix to obtain a fifth grayscale sub - matrix; perform an exclusive - OR operation on the fifth grayscale sub - matrix and the third grayscale sub - matrix to obtain a sixth grayscale sub - matrix; merge the sixth grayscale sub - matrix and the fourth grayscale sub - matrix to obtain the encrypted second image. The present disclosure can use an amplitude - value encryption algorithm, chaotic technology based on a lattice model, and a push - type encryption algorithm to perform encryption operations on images, which can effectively scramble the pixel data features in the images, reduce the correlation degree between pixels in the encrypted image, make the encrypted image difficult to be attacked and cracked, and effectively guarantee the information security of the image.
[0119] Optionally, the encryption parameter further includes the number of encryption rounds.
[0120] Among them, the number of encryption rounds can be set according to actual needs. Preferably, the number of encryption rounds can be 5.
[0121] Optionally, based on Figure 1 the method shown, such as Figure 6 shown, a schematic flowchart of another implementation manner of the image encryption method provided by the embodiments of the present disclosure. After step S800, the image encryption method may further include:
[0122] A100. Increment the encryption count of the first image by 1.
[0123] The embodiments of the present disclosure can count the encryption count of the first image. After encrypting the first image into the encrypted second image, increment the encryption count of the first image by 1.
[0124] A200. When the encryption count does not exceed the number of encryption rounds, use the second image as the first image, use the third grayscale matrix corresponding to the second image as the first grayscale matrix, and return to execute step S300.
[0125] The embodiments of the present disclosure can, when the encryption count does not exceed the number of encryption rounds, perform another round of amplitude encryption processing, push - type encryption algorithm encryption processing, and a series of exclusive - OR processing encryption on the encrypted second image to further encrypt the image until the encryption count reaches the number of encryption rounds.
[0126] It can be understood that the decryption operation corresponding to the image encryption method provided by the embodiments of the present disclosure uses the same algorithm. For the encrypted image, use the same chaotic key to perform the same decryption process as the encryption process, and decrypt by running one less decryption round than the number of encryption rounds.
[0127] Optionally, based on Figure 1 the method shown, such as Figure 7 shown, a schematic flowchart of another implementation manner of the image encryption method provided by the embodiments of the present disclosure. After step S800, the image encryption method may further include:
[0128] B100. Compare and analyze the first image and the second image according to a preset encryption effect analysis algorithm to obtain an image encryption analysis result.
[0129] Among them, the preset encryption effect analysis algorithm may include at least one of a bipolar correlation value algorithm, a grayscale average value algorithm, a mean square error comparison algorithm, a key space analysis algorithm, a key sensitivity analysis algorithm, a grayscale histogram algorithm, an information entropy algorithm, an adjacent pixel correlation algorithm, and a differential analysis algorithm.
[0130] In practice, the image encryption analysis results obtained by analyzing the first image and the second image through the above-mentioned preset encryption effect analysis algorithm show that even if the unencrypted image undergoes minor changes, the encrypted image obtained by encryption will undergo huge changes. Therefore, the image encryption method provided by the embodiments of the present disclosure can achieve higher image encryption security, can resist differential attacks of different degrees, and can ensure the security of users' image information.
[0131] The embodiments of the present disclosure analyze and evaluate the image encryption effect through a variety of encryption effect analysis algorithms, can determine the encryption effect of the encrypted image, and generate corresponding image encryption analysis results, which is convenient for technicians to improve the encryption-related parameters according to the image encryption analysis results.
[0132] Although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous.
[0133] It should be understood that the various steps recited in the method embodiments of the present disclosure can be executed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.
[0134] Corresponding to the above method embodiments, the embodiments of the present disclosure also provide an image encryption device, the structure of which is as Figure 8 shown, and may include: a first obtaining unit 100, a second obtaining unit 200, a third obtaining unit 300, a first dividing unit 400, a first encryption unit 500, a second encryption unit 600, a fourth obtaining unit 700, and a fifth obtaining unit 800.
[0135] The first obtaining unit 100 is configured to obtain a first grayscale matrix corresponding to an unencrypted first image, where the first grayscale matrix is composed of the grayscale values of each pixel point in the first image.
[0136] The second obtaining unit 200 is configured to obtain encryption parameters input by a user, where the encryption parameters include a chaotic key.
[0137] The third obtaining unit 300 is configured to perform chaotic processing on the first grayscale matrix by using the chaotic key based on a lattice model to obtain a first chaotic matrix.
[0138] The first dividing unit 400 is configured to divide the first image into a first sub-image and a second sub-image, where the first sub-image corresponds to a first grayscale sub-matrix in the first grayscale matrix, and the second sub-image corresponds to a second grayscale sub-matrix in the first grayscale matrix.
[0139] The first encryption unit 500 is configured to perform amplitude encryption processing on the first grayscale matrix by using an amplitude value encryption algorithm to obtain a second grayscale matrix, where the first grayscale sub-matrix corresponds to the third grayscale sub-matrix in the second grayscale matrix, and the second grayscale sub-matrix corresponds to the fourth grayscale sub-matrix in the second grayscale matrix.
[0140] The second encryption unit 600 is configured to perform encryption processing on the fourth grayscale sub-matrix by using a first chaotic matrix based on a push-type encryption algorithm to obtain a fifth grayscale sub-matrix.
[0141] The fourth obtaining unit 700 is configured to perform an exclusive OR operation on the fifth grayscale sub-matrix and the third grayscale sub-matrix to obtain a sixth grayscale sub-matrix.
[0142] The fifth obtaining unit 800 is configured to merge the sixth grayscale sub-matrix and the fourth grayscale sub-matrix to obtain an encrypted second image.
[0143] Optionally, the chaotic key includes a first key and a second key.
[0144] Optionally, the third obtaining unit 300 includes: a first obtaining subunit, a second obtaining subunit, a third obtaining subunit, and a fourth obtaining subunit.
[0145] The first obtaining subunit is configured to perform Chebyshev mapping on the first grayscale matrix by using the first key and the second key in sequence based on a lattice model to obtain a second chaotic matrix.
[0146] The second obtaining subunit is configured to perform unidirectional coupled chaos processing on the second chaotic matrix to obtain a third chaotic matrix.
[0147] The third obtaining subunit is configured to perform bidirectional coupled chaos processing on the third chaotic matrix to obtain a fourth chaotic matrix.
[0148] The fourth obtaining subunit is configured to perform integer data processing on the fourth chaotic matrix to obtain a first chaotic matrix.
[0149] Optionally, the first encryption unit 500 includes: a fifth obtaining subunit, a sixth obtaining subunit, a seventh obtaining subunit, and an eighth obtaining subunit.
[0150] The fifth obtaining subunit is configured to perform a fast Fourier transform on the first grayscale matrix to obtain a first amplitude spectrum matrix.
[0151] The sixth obtaining subunit is configured to perform amplitude weakening processing on the first amplitude spectrum matrix to obtain a second amplitude spectrum matrix, where the first amplitude spectrum sub-matrix in the second amplitude spectrum matrix corresponds to the first grayscale sub-matrix, and the second amplitude spectrum sub-matrix in the second amplitude spectrum matrix corresponds to the second grayscale sub-matrix.
[0152] A seventh obtaining subunit, configured to perform exclusive OR processing on the first amplitude spectrum sub-matrix and the first grayscale sub-matrix, and perform exclusive OR processing on the second amplitude spectrum sub-matrix and the second grayscale sub-matrix, to obtain a third amplitude spectrum matrix.
[0153] An eighth obtaining subunit, configured to perform an inverse fast Fourier transform on the third amplitude spectrum matrix to obtain a second grayscale matrix.
[0154] Optionally, the second encryption unit 600 includes: a ninth obtaining subunit and a tenth obtaining subunit.
[0155] The ninth obtaining subunit is configured to process the first chaotic matrix according to a preset chaotic value preprocessing algorithm to obtain a fifth chaotic matrix.
[0156] The tenth obtaining subunit is configured to, based on a push-type encryption algorithm, use the chaotic values in the fifth chaotic matrix as a third key to encrypt the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix.
[0157] Optionally, the fifth obtaining unit 800 may specifically be configured to perform position swapping and splicing on the sixth grayscale sub-matrix and the fourth grayscale sub-matrix to obtain an encrypted second image, where the position of the fourth grayscale sub-matrix in the second image is the same as the corresponding position of the first grayscale sub-matrix in the first image, and the position of the sixth grayscale sub-matrix in the second image is the same as the corresponding position of the second grayscale sub-matrix in the first image.
[0158] Optionally, the encryption parameter further includes the number of encryption rounds.
[0159] Optionally, the image encryption device may further include: an encryption times statistics unit and a first determination unit.
[0160] The encryption times statistics unit is configured to increment the encryption times of the first image by 1 after the fifth obtaining unit 800 obtains the encrypted second image.
[0161] The first determination unit is configured to, when the encryption times do not exceed the number of encryption rounds, use the second image as the first image and use the third grayscale matrix corresponding to the second image as the first grayscale matrix, and trigger the third obtaining unit 300.
[0162] Optionally, the image encryption device may further include: a sixth obtaining unit.
[0163] The sixth obtaining unit is configured to, after the fifth obtaining unit 800 obtains the encrypted second image, perform comparative analysis on the first image and the second image according to a preset encryption effect analysis algorithm to obtain an image encryption analysis result.
[0164] An image encryption device provided by the present disclosure can obtain a first grayscale matrix corresponding to an unencrypted first image, where the first grayscale matrix is composed of the grayscale values of each pixel point in the first image; obtain encryption parameters input by a user, where the encryption parameters include a chaotic key; based on a lattice model, use the chaotic key to perform chaotic processing on the first grayscale matrix to obtain a first chaotic matrix; divide the first image into a first sub-image and a second sub-image, where the first sub-image corresponds to a first grayscale sub-matrix in the first grayscale matrix, and the second sub-image corresponds to a second grayscale sub-matrix in the first grayscale matrix; use an amplitude value encryption algorithm to perform amplitude encryption processing on the first grayscale matrix to obtain a second grayscale matrix, where the first grayscale sub-matrix corresponds to a third grayscale sub-matrix in the second grayscale matrix, and the second grayscale sub-matrix corresponds to a fourth grayscale sub-matrix in the second grayscale matrix; based on a push-type encryption algorithm, use the first chaotic matrix to encrypt the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix; perform an exclusive OR operation on the fifth grayscale sub-matrix and the third grayscale sub-matrix to obtain a sixth grayscale sub-matrix; and merge the sixth grayscale sub-matrix and the fourth grayscale sub-matrix to obtain an encrypted second image. The present disclosure can use an amplitude value encryption algorithm, chaotic technology based on a lattice model, and a push-type encryption algorithm to perform encryption operations on an image, can effectively scramble the pixel data features in the image, reduce the correlation degree between pixels in the encrypted image, make the encrypted image difficult to be attacked and cracked, and effectively guarantee the information security of the image.
[0165] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.
[0166] The image encryption device includes a processor and a memory. The above first obtaining unit 100, second obtaining unit 200, third obtaining unit 300, first dividing unit 400, first encrypting unit 500, second encrypting unit 600, fourth obtaining unit 700, and fifth obtaining unit 800, etc. are all stored in the memory as program units, and the processor executes the above program units stored in the memory to implement corresponding functions.
[0167] The processor includes a kernel, and the kernel retrieves the corresponding program units from the memory. One or more kernels can be set, and by adjusting the kernel parameters, an amplitude value encryption algorithm, chaotic technology based on a lattice model, and a push-type encryption algorithm are used to perform encryption operations on an image, can effectively scramble the pixel data features in the image, reduce the correlation degree between pixels in the encrypted image, make the encrypted image difficult to be attacked and cracked, and effectively guarantee the information security of the image.
[0168] An embodiment of the present disclosure provides a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the image encryption method is implemented.
[0169] An embodiment of the present disclosure provides a processor, which is used to run a program, and when the program runs, the image encryption method is executed.
[0170] An embodiment of the present disclosure provides an electronic device, which includes at least one processor, at least one memory connected to the processor, and a bus; wherein, the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the above-mentioned image encryption method. The electronic device herein may be a server, a PC, a PAD, a mobile phone, etc.
[0171] The present disclosure also provides a computer program product, which is adapted to execute a program initialized with steps of the image encryption method when executed on an electronic device.
[0172] The present disclosure is described with reference to the flowcharts and / or block diagrams of methods, apparatuses, electronic devices (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable devices generate a device for implementing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0173] In a typical configuration, an electronic device includes one or more processors (CPUs), a memory, and a bus. The electronic device may also include an input / output interface, a network interface, etc.
[0174] The memory may include non-permanent memory in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM), and the memory includes at least one storage chip. The memory is an example of a computer-readable medium.
[0175] A computer-readable medium includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer-readable medium does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0176] In the description of the present disclosure, it should be understood that if terms such as "upper", "lower", "front", "rear", "left", and "right" are used to indicate the orientation or positional relationship, they are based on the orientation or positional relationship shown in the drawings. This is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the indicated position or element must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation of the present disclosure.
[0177] It should be noted that in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. It should also be noted that the term "comprising", "including", or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, commodity, or device that includes a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, commodity, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the presence of additional identical elements in the process, method, commodity, or device that includes the element.
[0178] Those skilled in the art should understand that the embodiments of the present disclosure can be provided as a method, a system, or a computer program product. Therefore, the present disclosure can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present disclosure can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0179] The above are only embodiments of the present disclosure and are not intended to limit the present disclosure. For those skilled in the art, various modifications and variations can be made to the present disclosure. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present disclosure shall be included within the scope of the claims of the present disclosure.
Claims
1. An image encryption method, characterized in that, Including: Obtain a first grayscale matrix corresponding to the unencrypted first image, where the first grayscale matrix is composed of the grayscale values of each pixel point in the first image; Obtain the encryption parameters input by the user, where the encryption parameters include a chaotic key; Based on a lattice model, use the chaotic key to perform chaotic processing on the first grayscale matrix to obtain a first chaotic matrix; Divide the first image into a first sub-image and a second sub-image, where the first sub-image corresponds to a first grayscale sub-matrix in the first grayscale matrix, and the second sub-image corresponds to a second grayscale sub-matrix in the first grayscale matrix; Perform a fast Fourier transform on the first grayscale matrix to obtain a first amplitude spectrum matrix; Perform amplitude attenuation processing on the first amplitude spectrum matrix to obtain a second amplitude spectrum matrix, where a first amplitude spectrum sub-matrix in the second amplitude spectrum matrix corresponds to the first grayscale sub-matrix, and a second amplitude spectrum sub-matrix in the second amplitude spectrum matrix corresponds to the second grayscale sub-matrix; Perform an exclusive OR operation on the first amplitude spectrum sub-matrix and the first grayscale sub-matrix, and perform an exclusive OR operation on the second amplitude spectrum sub-matrix and the second grayscale sub-matrix to obtain a third amplitude spectrum matrix; Perform an inverse fast Fourier transform on the third amplitude spectrum matrix to obtain a second grayscale matrix, where the first grayscale sub-matrix corresponds to a third grayscale sub-matrix in the second grayscale matrix, and the second grayscale sub-matrix corresponds to a fourth grayscale sub-matrix in the second grayscale matrix; Based on a push-type encryption algorithm, use the first chaotic matrix to encrypt the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix; Perform an exclusive OR operation on the fifth grayscale sub-matrix and the third grayscale sub-matrix to obtain a sixth grayscale sub-matrix; Merge the sixth grayscale sub-matrix and the fourth grayscale sub-matrix to obtain the encrypted second image.
2. The method according to claim 1, characterized in that, The chaotic key includes a first key and a second key. The step of, based on a lattice model, using the chaotic key to perform chaotic processing on the first grayscale matrix to obtain a first chaotic matrix includes: Based on a lattice model, sequentially use the first key and the second key to perform a Chebyshev mapping on the first grayscale matrix to obtain a second chaotic matrix; Perform unidirectional coupled chaotic processing on the second chaotic matrix to obtain a third chaotic matrix; Perform bidirectional coupled chaotic processing on the third chaotic matrix to obtain a fourth chaotic matrix; Perform integer data processing on the fourth chaotic matrix to obtain a first chaotic matrix.
3. The method according to claim 1, characterized in that, The step of, based on a push-type encryption algorithm, using the first chaotic matrix to encrypt the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix includes: Process the first chaotic matrix according to a preset chaotic value preprocessing algorithm to obtain a fifth chaotic matrix; Based on a push-type encryption algorithm, use the chaotic value in the fifth chaotic matrix as a third key to encrypt the fourth grayscale sub-matrix to obtain a fifth grayscale sub-matrix.
4. The method according to claim 1, characterized in that, The step of merging the sixth grayscale sub-matrix and the fourth grayscale sub-matrix to obtain the encrypted second image includes: Interchange the positions of the sixth grayscale sub - matrix and the fourth grayscale sub - matrix and splice them to obtain the encrypted second image, where the position of the fourth grayscale sub - matrix in the second image is the same as the corresponding position of the first grayscale sub - matrix in the first image, and the position of the sixth grayscale sub - matrix in the second image is the same as the corresponding position of the second grayscale sub - matrix in the first image.
5. The method according to claim 1, wherein The encryption parameter further includes the number of encryption rounds. After obtaining the encrypted second image, the method further includes: Increment the encryption count of the first image by 1; If the encryption count does not exceed the number of encryption rounds, use the second image as the first image, use the third grayscale matrix corresponding to the second image as the first grayscale matrix, and return to execute the step of performing chaotic processing on the first grayscale matrix using the chaotic key based on the lattice model to obtain the first chaotic matrix.
6. The method according to claim 1, characterized in that, After obtaining the encrypted second image, the method further includes: Perform comparative analysis on the first image and the second image according to a preset encryption effect analysis algorithm to obtain an image encryption analysis result.
7. An image encryption device, characterized in that, Including: A first obtaining unit, a second obtaining unit, a third obtaining unit, a first partitioning unit, a first encryption unit, a second encryption unit, a fourth obtaining unit, and a fifth obtaining unit. The first obtaining unit is used to obtain the first grayscale matrix corresponding to the unencrypted first image, where the first grayscale matrix is composed of the grayscale values of each pixel point in the first image; The second obtaining unit is used to obtain the encryption parameters input by the user, where the encryption parameters include the chaotic key; The third obtaining unit is used to perform chaotic processing on the first grayscale matrix using the chaotic key based on the lattice model to obtain the first chaotic matrix; The first partitioning unit is used to partition the first image into a first sub - image and a second sub - image, where the first sub - image corresponds to the first grayscale sub - matrix in the first grayscale matrix, and the second sub - image corresponds to the second grayscale sub - matrix in the first grayscale matrix; The first encryption unit is used to perform amplitude encryption processing on the first grayscale matrix using the amplitude - value encryption algorithm to obtain the second grayscale matrix, where the first grayscale sub - matrix corresponds to the third grayscale sub - matrix in the second grayscale matrix, and the second grayscale sub - matrix corresponds to the fourth grayscale sub - matrix in the second grayscale matrix; The second encryption unit is used to perform encryption processing on the fourth grayscale sub - matrix using the first chaotic matrix based on the push - type encryption algorithm to obtain the fifth grayscale sub - matrix; The fourth obtaining unit is used to perform exclusive - OR processing on the fifth grayscale sub - matrix and the third grayscale sub - matrix to obtain the sixth grayscale sub - matrix; The fifth obtaining unit is used to merge the sixth grayscale sub - matrix and the fourth grayscale sub - matrix to obtain the encrypted second image; Wherein, the first encryption unit includes: a fifth obtaining subunit, a sixth obtaining subunit, a seventh obtaining subunit, and an eighth obtaining subunit; The fifth obtaining subunit is configured to perform a fast Fourier transform on the first grayscale matrix to obtain a first amplitude spectrum matrix; The sixth obtaining subunit is configured to perform an amplitude attenuation process on the first amplitude spectrum matrix to obtain a second amplitude spectrum matrix, where the first amplitude spectrum sub-matrix in the second amplitude spectrum matrix corresponds to the first grayscale sub-matrix, and the second amplitude spectrum sub-matrix in the second amplitude spectrum matrix corresponds to the second grayscale sub-matrix; The seventh obtaining subunit is configured to perform an exclusive OR operation on the first amplitude spectrum sub-matrix and the first grayscale sub-matrix, and perform an exclusive OR operation on the second amplitude spectrum sub-matrix and the second grayscale sub-matrix to obtain a third amplitude spectrum matrix; The eighth obtaining subunit is configured to perform an inverse fast Fourier transform on the third amplitude spectrum matrix to obtain a second grayscale matrix.
8. A computer-readable storage medium having a program stored thereon, characterized in that, When the program is executed by the processor, it implements the image encryption method according to any one of claims 1 to 6.
9. An electronic device, the electronic device includes at least one processor, and at least one memory and a bus connected to the processor; wherein, The processor and the memory complete communication with each other through the bus; The processor is configured to call the program instructions in the memory to execute the image encryption method according to any one of claims 1 to 6.
Citation Information
Patent Citations
New image encryption method
CN109660696A
Image encryption method and apparatus, sensor and readable storage medium
US20210044418A1