Image encryption method and device, communication equipment and storage medium
The Lorentz chaotic system-based image encryption method enhances security and efficiency by transforming and scrambling pixel values, addressing the limitations of existing methods in real-time scenarios.
Patent Information
- Application Number
- CN202411319592.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-20
AI Technical Summary
Existing image encryption methods face challenges in achieving high security and efficiency, with symmetric algorithms being fast but insecure, and asymmetric algorithms being complex and computationally intensive, failing to meet real-time requirements.
An image encryption method using a Lorentz chaotic system to generate a target chaotic sequence matrix, transforming and scrambling pixel values to create an encrypted image, leveraging the system's initial condition sensitivity and long-term unpredictability for enhanced security and efficiency.
The method improves image encryption security by disrupting pixel distributions and resisting statistical attacks while maintaining computational efficiency, suitable for real-time applications.
Smart Images

Figure CN119172486A_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, communication equipment and storage medium. Background Art
[0002] With the rapid development of information technology, digital images are also facing huge security risks during network transmission. Images may contain sensitive information such as personal privacy, commercial secrets, and even national security. Once this information is illegally intercepted, tampered with, or destroyed, it will cause immeasurable losses to individuals, groups, and even the country. For example, medical images may contain patients' private information, and military images may contain confidential combat plans. Once this information is leaked, the consequences will be disastrous. Therefore, encrypting and protecting images to ensure their security during network transmission has become a necessary means to defend information security.
[0003] Existing image encryption methods mainly use symmetric encryption algorithms and asymmetric encryption algorithms. Symmetric encryption algorithms such as AES128 and AES256 have the advantages of fast encryption speed and high efficiency, but their security depends on the confidentiality of the key. Asymmetric encryption algorithms such as ECC and RSA have high security, but their encryption process is complex and computationally intensive, making it difficult to meet application scenarios with high real-time requirements. Therefore, it is urgent to study more secure and efficient image encryption algorithms to meet the increasingly severe information security challenges. Summary of the invention
[0004] In view of this, the present invention aims to propose an image encryption method, device, equipment and storage medium to solve the problems of low image encryption security and low efficiency existing in existing image encryption methods.
[0005] According to a first aspect of the present invention, there is provided an image encryption method, the method comprising:
[0006] Obtaining a target chaotic sequence matrix and a size of an image to be encrypted, wherein the target chaotic sequence matrix is obtained based on a Lorentz chaotic system;
[0007] Extracting pixel values of the image to be encrypted to obtain a pixel matrix of the image to be encrypted, wherein the pixel matrix of the image to be encrypted has the same size as the image to be encrypted;
[0008] Taking any of the target chaotic sequence matrices as a transformation matrix, transforming each pixel value in the pixel matrix according to the transformation matrix to obtain an initial ciphertext image;
[0009] The target chaotic sequence matrix other than at least two of the transformation matrices is used as a scrambling matrix, and the pixels in the initial ciphertext image are scrambled according to the at least two scrambling matrices to obtain an encrypted image.
[0010] Optionally, the acquiring a target chaotic sequence matrix includes:
[0011] Obtain at least three sets of key sequences and state equations of the Lorentz chaotic system;
[0012] Segmenting the key sequence according to a preset number of bits to obtain at least three groups of segmented key sequences, wherein each group of segmented key sequences includes a plurality of sub-key sequences;
[0013] Determining an average value of the key sequence according to the segmented key sequence and the number of the subkey sequences included in the segmented key sequence;
[0014] For any group of the segmented key sequences, determine the initial value corresponding to any group of the segmented key sequences according to the segmented key sequences and the average value of the key sequences, and obtain at least three initial values of the Lorenz chaotic system;
[0015] Determine at least three chaotic sequence matrices respectively according to at least three initial values and the state equation of the Lorentz chaotic system;
[0016] Matrix interception is performed on the chaotic sequence matrix respectively to obtain a target chaotic sequence matrix, wherein the target chaotic sequence matrix has the same size as the pixel matrix of the image to be encrypted.
[0017] Optionally, transforming each pixel value in the pixel matrix according to the transformation matrix to obtain an initial ciphertext image includes:
[0018] Transform the first row of pixel values in the pixel matrix according to the transformation matrix to obtain transformed first row of pixel values;
[0019] Transform the first column of pixel values in the pixel matrix according to the transformation matrix to obtain transformed first column of pixel values;
[0020] Transform other pixel values in the pixel matrix except the first row pixel value and the first column pixel value according to the transformation matrix to obtain the transformed other pixel values;
[0021] The transformed first row pixel values, the transformed first column pixel values, and the transformed other pixel values constitute an initial ciphertext image.
[0022] Optionally, scrambling the positions of pixels in the initial ciphertext image according to at least two scrambling matrices to obtain an encrypted image comprises:
[0023] Sequentially intercepting the scrambled matrices respectively to obtain scrambled sequences, wherein the length of the scrambled sequences is the same as the number of pixels in the initial ciphertext image;
[0024] Decomposing pixels in the initial ciphertext image into a plurality of binary bit planes;
[0025] Dividing each of the binary bit planes to obtain a plurality of sub-blocks, wherein the number of the sub-blocks in each of the binary bit planes is the same as the number of pixels in the initial ciphertext image;
[0026] For any of the sub-blocks in any of the binary bit planes, obtaining a binary bit plane number where the sub-block is located and a position of the sub-block in the binary bit plane;
[0027] Taking any one of the scrambled sequences as a binary bit plane number determination sequence, determining a first target binary bit plane number according to the binary bit plane number of the sub-block, a preset value, the position of the sub-block in the binary bit plane, and the binary bit plane number determination sequence;
[0028] Using any of the scrambled sequences except the binary bit plane number determination sequence as a position determination sequence, and determining a first target position according to the number of the binary bit plane where the sub-block is located, the preset value, the position of the sub-block in the binary bit plane, and the position determination sequence;
[0029] Permuting the position of the sub-block at the first target position in the first target binary bit plane number with the sub-block to obtain a plurality of scrambled binary bit planes;
[0030] The plurality of scrambled binary bit planes are synthesized to obtain an encrypted image.
[0031] Optionally, after the step of scrambling the positions of pixels in the initial ciphertext image according to at least two scrambling matrices to obtain an encrypted image, the method includes:
[0032] Performing position inverse scrambling on pixels in the encrypted image according to at least two scrambling matrices to obtain an initial plaintext image;
[0033] Perform an inverse transformation on each pixel value in the initial plaintext image according to the transformation matrix to obtain a decrypted image.
[0034] Optionally, performing position inverse scrambling on pixels in the encrypted image according to at least two scrambling matrices to obtain an initial plaintext image includes:
[0035] Decomposing pixels in the encrypted image into a plurality of binary bit planes;
[0036] Dividing each of the binary bit planes to obtain a plurality of sub-blocks, wherein the number of the sub-blocks in each of the binary bit planes is the same as the number of pixels in the encrypted image;
[0037] For any of the sub-blocks in any of the binary bit planes, obtaining a binary bit plane number where the sub-block is located and a position of the sub-block in the binary bit plane;
[0038] Determine a second target binary bit plane number according to the binary bit plane number of the sub-block, the preset value, the position of the sub-block in the binary bit plane, and the binary bit plane number determination sequence;
[0039] Determine a second target position according to the number of the binary bit plane where the sub-block is located, the preset value, the position of the sub-block in the binary bit plane, and the position determination sequence;
[0040] Permuting the sub-block at the second target position in the second target binary bit plane number with the sub-block to obtain a plurality of inversely perturbed binary bit planes;
[0041] The multiple inversely scrambled binary bit planes are synthesized to obtain an initial plaintext image.
[0042] Optionally, performing an inverse transformation on each pixel value in the initial plaintext image according to the transformation matrix to obtain a decrypted image includes:
[0043] Performing an inverse transformation on the first row of pixel values in the initial plaintext image according to the transformation matrix to obtain the first row of pixel values after inverse transformation;
[0044] Performing an inverse transformation on the first column of pixel values in the initial plaintext image according to the transformation matrix to obtain the first column of pixel values after inverse transformation;
[0045] Performing an inverse transformation on other pixel values in the initial plaintext image except the first row pixel value and the first column pixel value according to the transformation matrix to obtain the other pixel values after inverse transformation;
[0046] The first row of pixel values after inverse transformation, the first column of pixel values after inverse transformation, and the other pixel values after inverse transformation constitute a decrypted image.
[0047] According to a second aspect of the present invention, there is provided an image encryption device, the image encryption device comprising:
[0048] A data acquisition module, used to acquire a target chaotic sequence matrix and the size of an image to be encrypted, wherein the target chaotic sequence matrix is obtained based on a Lorentz chaotic system;
[0049] A pixel value extraction module, used for extracting pixel values of the image to be encrypted to obtain a pixel matrix of the image to be encrypted, wherein the pixel matrix of the image to be encrypted has the same size as the image to be encrypted;
[0050] A pixel value diffusion module, used for taking any of the target chaotic sequence matrices as a transformation matrix, transforming each pixel value in the pixel matrix according to the transformation matrix, and obtaining an initial ciphertext image;
[0051] The pixel scrambling module is used to use the target chaotic sequence matrix other than at least two of the transformation matrices as a scrambling matrix, and scramble the positions of the pixels in the initial ciphertext image according to at least two of the scrambling matrices to obtain an encrypted image.
[0052] Optionally, the data acquisition module includes:
[0053] A key sequence acquisition submodule is used to acquire at least three sets of key sequences and state equations of the Lorentz chaotic system;
[0054] A key sequence segmentation submodule, used to segment the key sequence according to a preset number of bits to obtain at least three groups of segmented key sequences, wherein each group of segmented key sequences includes a plurality of sub-key sequences;
[0055] a key sequence average value determining submodule, configured to determine an average value of a key sequence according to the segmented key sequence and the number of subkey sequences included in the segmented key sequence;
[0056] A chaotic system initial value determination submodule is used to determine, for any group of the segmented key sequences, the initial value corresponding to the segmented key sequence of any group according to the segmented key sequence and the average value of the key sequence, to obtain at least three initial values of the Lorenz chaotic system;
[0057] A chaotic sequence matrix determination submodule, used to determine at least three chaotic sequence matrices respectively according to at least three initial values and the state equation of the Lorenz chaotic system;
[0058] The target chaotic sequence matrix determination submodule is used to perform matrix interception on the chaotic sequence matrix to obtain a target chaotic sequence matrix, wherein the target chaotic sequence matrix has the same size as the pixel matrix of the image to be encrypted.
[0059] Optionally, the pixel value diffusion module includes:
[0060] A first pixel value diffusion submodule, used for transforming the first row of pixel values in the pixel matrix according to the transformation matrix to obtain the transformed first row of pixel values;
[0061] A second pixel value diffusion submodule, used for transforming the first column of pixel values in the pixel matrix according to the transformation matrix to obtain the transformed first column of pixel values;
[0062] A third pixel value diffusion submodule, used for transforming other pixel values in the pixel matrix except the first row pixel value and the first column pixel value according to the transformation matrix to obtain the transformed other pixel values;
[0063] The initial ciphertext image determination submodule is used to form an initial ciphertext image with the transformed first row pixel values, the transformed first column pixel values and the transformed other pixel values.
[0064] Optionally, the pixel scrambling module includes:
[0065] A sequence interception submodule, used for performing sequence interception on the scrambled matrix to obtain a scrambled sequence, wherein the length of the scrambled sequence is the same as the number of pixels in the initial ciphertext image;
[0066] A first pixel decomposition submodule, used for decomposing pixels in the initial ciphertext image into a plurality of binary bit planes;
[0067] A first binary bit plane division submodule, used for dividing each of the binary bit planes to obtain a plurality of sub-blocks, wherein the number of the sub-blocks in each of the binary bit planes is the same as the number of pixels in the initial ciphertext image;
[0068] A first sub-block data acquisition sub-module, used for acquiring, for any of the sub-blocks in any of the binary bit planes, a binary bit plane number where the sub-block is located and a position of the sub-block in the binary bit plane;
[0069] A first target binary bit plane number determination submodule, configured to use any of the scrambled sequences as a binary bit plane number determination sequence, and determine a first target binary bit plane number according to the binary bit plane number of the sub-block, a preset value, the position of the sub-block in the binary bit plane, and the binary bit plane number determination sequence;
[0070] A first target position determination submodule, configured to use any of the scrambled sequences except the binary bit plane number determination sequence as a position determination sequence, and determine a first target position according to the number of the binary bit plane where the sub-block is located, the preset value, the position of the sub-block in the binary bit plane, and the position determination sequence;
[0071] A first position replacement submodule, used for performing position replacement of the sub-block at the first target position in the first target binary bit plane number with the sub-block to obtain a plurality of scrambled binary bit planes;
[0072] The first binary bit plane synthesis submodule is used to synthesize the multiple scrambled binary bit planes to obtain an encrypted image.
[0073] Optionally, the device comprises:
[0074] A pixel inverse scrambling module, used for performing position inverse scrambling on pixels in the encrypted image according to at least two scrambling matrices to obtain an initial plaintext image;
[0075] The pixel value inverse diffusion module is used to perform an inverse transformation on each pixel value in the initial plaintext image according to the transformation matrix to obtain a decrypted image.
[0076] Optionally, the pixel descrambling module includes:
[0077] A second pixel decomposition submodule, used for decomposing pixels in the encrypted image into a plurality of binary bit planes;
[0078] A second binary bit plane division submodule, used for dividing each of the binary bit planes to obtain a plurality of sub-blocks, wherein the number of the sub-blocks in each of the binary bit planes is the same as the number of pixels in the encrypted image;
[0079] A second sub-block data acquisition sub-module, configured to acquire, for any of the sub-blocks in any of the binary bit planes, a binary bit plane number where the sub-block is located and a position of the sub-block in the binary bit plane;
[0080] A second target binary bit plane number determination submodule, configured to determine a second target binary bit plane number according to the binary bit plane number of the sub-block, the preset value, the position of the sub-block in the binary bit plane, and the binary bit plane number determination sequence;
[0081] A second target position determination submodule, configured to determine a second target position according to the number of the binary bit plane where the sub-block is located, the preset value, the position of the sub-block in the binary bit plane, and the position determination sequence;
[0082] A second position replacement submodule, used for performing position replacement of the sub-block at the second target position in the second target binary bit plane number with the sub-block to obtain a plurality of inversely scrambled binary bit planes;
[0083] The second binary bit plane synthesis submodule is used to synthesize the multiple inverse scrambled binary bit planes to obtain an initial plaintext image.
[0084] Optionally, the pixel value inverse diffusion module includes:
[0085] A first pixel value inverse diffusion submodule, configured to perform an inverse transformation on the first row of pixel values in the initial plaintext image according to the transformation matrix to obtain the first row of pixel values after inverse transformation;
[0086] A second pixel value inverse diffusion submodule, configured to perform an inverse transformation on the first column of pixel values in the initial plaintext image according to the transformation matrix to obtain the first column of pixel values after inverse transformation;
[0087] A third pixel value inverse diffusion submodule is used to perform an inverse transformation on other pixel values in the initial plaintext image except the first row pixel value and the first column pixel value according to the transformation matrix to obtain the other pixel values after inverse transformation;
[0088] The decrypted image determination submodule is used to form a decrypted image from the inverse transformed first row pixel values, the inverse transformed first column pixel values, and the inverse transformed other pixel values.
[0089] According to another aspect of the present invention, there is also provided an electronic device, comprising:
[0090] processor;
[0091] a memory for storing instructions executable by the processor;
[0092] Wherein, the processor is configured to execute the instructions to implement the image encryption method as described above.
[0093] According to another aspect of the present invention, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image encryption method described above are implemented.
[0094] The image encryption method provided by the embodiment of the present invention obtains a target chaotic sequence matrix and the size of an image to be encrypted, wherein the target chaotic sequence matrix is obtained based on a Lorentz chaotic system; pixel values of the image to be encrypted are extracted to obtain a pixel matrix of the image to be encrypted, wherein the pixel matrix of the image to be encrypted is the same as the size of the image to be encrypted; any target chaotic sequence matrix is used as a transformation matrix, and each pixel value in the pixel matrix is transformed according to the transformation matrix to obtain an initial ciphertext image; at least two target chaotic sequence matrices other than the first target chaotic sequence matrices are used as scrambling matrices, and pixels in the initial ciphertext image are positionally scrambled according to at least two scrambling matrices to obtain an encrypted image. Since the Lorentz chaotic system has the characteristics of initial condition sensitivity and long-term unpredictability, the present invention generates a target chaotic sequence matrix by using the Lorentz chaotic system, so that the generated target chaotic sequence matrix also has good randomness and unpredictability, and then uses the target chaotic sequence matrix to transform the pixel values of the encrypted image, which can change the distribution of the pixel values and increase the difficulty of cracking. Then, the target chaotic sequence matrix is used to scramble the position of the pixels of the encrypted image, which can further disrupt the image structure and enhance the encryption effect, and then can effectively resist statistical analysis attacks and known plaintext attacks, and achieve the technical effect of improving the security of image encryption. At the same time, the computational complexity of the target chaotic sequence matrix generated by the Lorentz chaotic system adopted by the present invention is low, and the operation of the transformation matrix and the scrambling matrix is simple and efficient, which can effectively improve the efficiency of image encryption under the premise of ensuring security, and meet the application scenarios with high real-time requirements. Therefore, the present invention can solve the problems of low image encryption security and low efficiency existing in the existing image encryption methods.
[0095] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0096] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0097] Figure 1 One of the step flow charts of an image encryption method provided by an embodiment of the present invention;
[0098] Figure 2This is the second step flow chart of an image encryption method provided by an embodiment of the present invention;
[0099] Figure 3 This is a flowchart of the steps of an image encryption method provided by an embodiment of the present invention;
[0100] Figure 4 is a schematic diagram of a binary bit plane provided by an embodiment of the present invention;
[0101] Figure 5 is a device block diagram of an image encryption device provided by an embodiment of the present invention;
[0102] Figure 6 It is a schematic diagram of a communication device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0103] To make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.
[0104] Reference Figure 1 , shows one of the step flow charts of the image encryption method provided by an embodiment of the present invention, the method may include:
[0105] Step 101, obtaining a target chaotic sequence matrix and the size of an image to be encrypted, wherein the target chaotic sequence matrix is obtained based on a Lorentz chaotic system.
[0106] Step 102: extract pixel values of the image to be encrypted to obtain a pixel matrix of the image to be encrypted, wherein the pixel matrix of the image to be encrypted has the same size as the image to be encrypted.
[0107] It should be noted that, in the embodiment of the present invention, the target chaotic sequence is determined in advance based on the Lorentz chaotic system and the size of the image to be encrypted is obtained in advance.
[0108] Pixel values of the image to be encrypted are extracted to obtain a pixel matrix of the image to be encrypted, wherein the pixel matrix of the image to be encrypted has the same size as the image to be encrypted. For example, if the size of the image to be encrypted is M×N, the size of the pixel matrix of the image to be encrypted is also M×N.
[0109] Step 103: using any target chaotic sequence matrix as a transformation matrix, transforming each pixel value in the pixel matrix according to the transformation matrix to obtain an initial ciphertext image.
[0110] Step 104: Use the target chaotic sequence matrix other than the at least two transformation matrices as a scrambling matrix, and scramble the positions of the pixels in the initial ciphertext image according to the at least two scrambling matrices to obtain an encrypted image.
[0111] It should be noted that, in the embodiment of the present invention, after the target chaotic sequence matrix is obtained, any target chaotic sequence matrix is used as a transformation matrix, and each pixel value in the pixel matrix of the image to be encrypted is transformed according to the transformation matrix to obtain an initial ciphertext image. After the initial ciphertext image is obtained, the target chaotic sequence matrix other than at least two transformation matrices is used as a scrambling matrix, and the pixels in the initial ciphertext image are positionally scrambled according to at least two scrambling matrices to obtain an encrypted image.
[0112] Since the Lorentz chaotic system has the characteristics of initial condition sensitivity and long-term unpredictability, the present invention generates a target chaotic sequence matrix by using the Lorentz chaotic system, so that the generated target chaotic sequence matrix also has good randomness and unpredictability, and then uses the target chaotic sequence matrix to transform the pixel values of the encrypted image, which can change the distribution of the pixel values and increase the difficulty of cracking. Then, the target chaotic sequence matrix is used to scramble the position of the pixels of the encrypted image, which can further disrupt the image structure and enhance the encryption effect, and then can effectively resist statistical analysis attacks and known plaintext attacks, and achieve the technical effect of improving the security of image encryption. At the same time, the computational complexity of the target chaotic sequence matrix generated by the Lorentz chaotic system adopted by the present invention is low, and the operation of the transformation matrix and the scrambling matrix is simple and efficient, which can effectively improve the efficiency of image encryption under the premise of ensuring security, and meet the application scenarios with high real-time requirements. Therefore, the present invention can solve the problems of low image encryption security and low efficiency existing in the existing image encryption methods.
[0113] Furthermore, if Figure 2 As shown, a second flow chart of the steps of the image encryption method provided by an embodiment of the present invention is shown. In the embodiment of the present invention, step 101 may also include the following steps:
[0114] Step 201, obtaining at least three sets of key sequences and state equations of a Lorentz chaotic system.
[0115] At least three groups of key sequences randomly input by the user and the state equation of the Lorenz chaotic system are obtained in advance, wherein the state equation of the Lorenz chaotic system is as follows.
[0116]
[0117] Among them, x, y, and z are the three initial values of the Lorentz chaotic system. They are three chaotic sequence matrices, a=10, b=8 / 3, c=28.
[0118] Step 202, segment the key sequence according to preset bit numbers to obtain at least three groups of segmented key sequences, wherein each group of segmented key sequences includes a plurality of sub-key sequences.
[0119] It should be noted that, in the embodiment of the present invention, the length of the key sequence may be 128, and the preset number of bits may be 16.
[0120] By segmenting the key sequence into 16-bit segments, at least three groups of segmented key sequences can be obtained, wherein each group of segmented key sequences includes 8 sub-key sequences.
[0121] If the user randomly inputs three groups of key sequences, each group of key sequences is segmented according to the preset number of bits, and the three groups of segmented key sequences can be obtained as follows:
[0122]
[0123] Among them, K x ,K y ,K z They are the key sequences after three segments, and the key sequence K after segmentation x Including k x1 ,k x2 ,k x3 ,k x4 ,k x5 ,k x6 ,k x7 ,k x8 8 sub-key sequences, the segmented key sequence K y Including k y1 ,k y2 ,k y3 ,k y4 ,k y5 ,k y6 ,k y7 ,k y8 8 sub-key sequences, the segmented key sequence K z Including k z1 ,k z2 ,k z3 ,k z4 ,k z5 ,k z6 ,k z7 ,k z8 8 subkey sequences.
[0124] Step 203: Determine an average value of the key sequence according to the segmented key sequence and the number of subkey sequences included in the segmented key sequence.
[0125] Step 204, for any group of segmented key sequences, determine the initial value corresponding to any group of segmented key sequences according to the segmented key sequences and the average value of the key sequences, and obtain at least three initial values of the Lorenz chaotic system.
[0126] It should be noted that, in the embodiment of the present invention, after determining the segmented key sequence and the number of sub-key sequences included in the segmented key sequence, the average value of the key sequence can be determined based on the segmented key sequence and the number of sub-key sequences included in the segmented key sequence.
[0127] If the key sequence after segmentation is three groups, the key sequence after three groups of segments is K x ,K y ,K z , the segmented key sequence K x Including k x1 ,k x2 ,k x3 ,k x4 ,k x5 ,k x6 ,k x7 ,k x8 8 sub-key sequences, the segmented key sequence K y Including k y1 ,k y2 ,k y3 ,k y4 ,k y5 ,k y6 ,k y7 ,k y8 8 sub-key sequences, the segmented key sequence K z Including k z1 ,k z2 ,k z3 ,k z4 ,k z5 ,k z6 ,k z7 ,k z8 8 sub-key sequences. Then, the number of sub-key sequences included in the key sequence after three groups of segments is 24.
[0128] Substituting the subkey sequences contained in each of the three groups of segmented key sequences and the number of subkey sequences included in the three groups of segmented key sequences into formula (1), the average value of the key sequence can be obtained.
[0129]
[0130] Among them, mean is the average value of the key sequence, α is the segmented key sequence K x The sub-key sequence in the sequence, β is the segmented key sequence K y The sub-key sequence in the sequence, γ is the segmented key sequence K z The sub-key sequence number in the sequence, 24 is the key sequence K after three groups of segments x ,K y ,K z The number of subkey sequences to include.
[0131] For any group of segmented key sequences, the initial value corresponding to any group of segmented key sequences is determined according to the segmented key sequences and the average value of the key sequences, and at least three initial values of the Lorenz chaotic system are obtained. For example, the segmented key sequences are three groups, and the three segmented key sequences are K x ,K y ,K z . The segmented key sequence K x Included k x1 ,k x2 ,k x3 ,k x4 ,k x5 ,k x6 ,k x7 ,k x8 Substituting the average value of the 8 sub-key sequences and the key sequence into the following equation, we can get an initial value x0 of the Lorenz chaotic system. y Included k y1 ,k y2 ,k y3 ,k y4 ,k y5 ,k y6 ,k y7 ,k y8 Substituting the average value of the 8 sub-key sequences and the key sequence into the following equation, we can get an initial value y0 of the Lorenz chaotic system. z Included k z1 ,k z2 ,k z3 ,k z4 ,k z5 ,k z6 ,k z7 ,k z8 Substituting the average value of the 8 sub-key sequences and the key sequence into the following equation, we can obtain an initial value z0 of the Lorenz chaotic system.
[0132]
[0133] Among them, x0, y0, z0 are the three initial values of the Lorentz chaotic system, x, y, z are the three fixed values of the Lorentz chaotic system, k x1 ...k x8 is the segmented key sequence K x The 8 subkey sequences included are k y1 ...k y8 is the segmented key sequence K y The 8 subkey sequences included are k z1 ...k z8 is the segmented key sequence K z Includes 8 sub-key sequences, mean is the average value of the key sequence.
[0134] Step 205: Determine at least three chaotic sequence matrices respectively according to at least three initial values and the state equation of the Lorentz chaotic system.
[0135] It should be noted that, in the embodiment of the present invention, after obtaining at least three initial values of the Lorentz chaotic system, the at least three initial values of the Lorentz chaotic system are substituted into the state equation of the Lorentz chaotic system to obtain at least three chaotic sequence matrices. For example, if the three initial values of the Lorentz chaotic system are x0, y0, and z0, respectively, then x0, y0, and z0 are substituted into the state equation of the Lorentz chaotic system to obtain three chaotic sequence matrices by calculation:
[0136] Step 206, performing matrix interception on the chaotic sequence matrix to obtain a target chaotic sequence matrix, wherein the target chaotic sequence matrix has the same size as the pixel matrix of the image to be encrypted.
[0137] It should be noted that, in the embodiment of the present invention, after obtaining at least three chaotic sequence matrices, matrix interception is performed on each chaotic sequence matrix to obtain a target chaotic sequence matrix, wherein the target chaotic sequence matrix has the same size as the pixel matrix of the image to be encrypted.
[0138] The present invention realizes dynamic key generation by using the key sequence input by the user and the state equation of the Lorentz chaotic system to generate the target chaotic sequence matrix through a series of mathematical operations. The key used in each encryption process is different, which effectively avoids the security risks caused by fixed keys.
[0139] Furthermore, if Figure 3 As shown, a third step flow chart of the image encryption method provided by an embodiment of the present invention is shown. In the embodiment of the present invention, step 103 may also include the following steps:
[0140] Step 301 , transform the first row of pixel values in the pixel matrix according to the transformation matrix to obtain the transformed first row of pixel values.
[0141] It should be noted that, in the embodiment of the present invention, the first row of pixel values in the pixel matrix of the image to be encrypted is transformed according to the transformation matrix to obtain the transformed first row of pixel values. Specifically, the first pixel value in the first row of pixel values is transformed according to formula (2) to obtain the transformed first pixel value in the first row of pixel values. The pixel matrix of the image to be encrypted can be represented by A.
[0142] A(1,1)=mod(P(1,1)+X(1,1),256) Formula (2)
[0143] Among them, A(1,1) is the first pixel value after transformation in the first row of pixel values, P(1,1) is the first pixel value in the first row of pixel values, and X(1,1) is the value corresponding to the coordinate (1,1) in the transformation matrix.
[0144] According to formula (3), the other pixel values in the first row of pixel values except the first pixel value are transformed to obtain the other pixel values in the first row of pixel values after transformation.
[0145] A(1,j)=mod(P(1,j)+X(1,j)+A(1,j-1),256)(j=2,3,4,…,N) Formula (3)
[0146] Among them, A(1,j) is the other pixel values after transformation in the first row of pixel values, P(1,j) is the other pixel values in the first row of pixel values, X(1,j) is the value corresponding to the coordinate (1,j) in the transformation matrix, and j is the pixel value in the first row of pixel values.
[0147] Step 302: transform the first column of pixel values in the pixel matrix according to the transformation matrix to obtain the transformed first column of pixel values.
[0148] It should be noted that, in the embodiment of the present invention, the first column of pixel values in the pixel matrix of the encrypted image is transformed according to the transformation matrix to obtain the transformed first column of pixel values. Specifically, each pixel value in the first column of pixel values is transformed according to formula (4) to obtain the transformed first column of pixel values.
[0149] A(i,1)=mod(P(i,1)+X(i,1)+A(i-1,1),256)(i=2,3,4,…,M) Formula (4)
[0150] Among them, A(i,1) is the first column of pixel values after transformation, P(i,1) is the first column of pixel values, X(i,1) is the value corresponding to the coordinate (i,1) in the transformation matrix, and i is the pixel value in the first column of pixel values.
[0151] Step 303: transform the other pixel values in the pixel matrix except the pixel values in the first row and the pixel values in the first column according to the transformation matrix to obtain the other transformed pixel values.
[0152] It should be noted that, in the embodiment of the present invention, the pixel values other than the first row pixel values and the first column pixel values in the pixel matrix are transformed according to the transformation matrix to obtain the transformed pixel values. Specifically, the pixel values other than the first row pixel values and the first column pixel values are transformed according to formula (5) to obtain the transformed pixel values.
[0153] A(i,j)=mod(P(i,j)+A(i-1,j)+A(i,j-1)+X(i,j), 256) Formula (5)
[0154] Among them, A(i,j) is the other pixel value after transformation, P(i,j) is the other pixel value, A(i-1,j) is the transformed pixel value corresponding to the pixel value of the i-1th row and jth column in the pixel matrix, A(i,j-1) is the transformed pixel value corresponding to the pixel value of the i-th row and j-1th column in the pixel matrix, X(i,j) is the value corresponding to the coordinate (i,j) in the transformation matrix, i is the row in the pixel matrix, i=2,3,4,…,M, j is the column in the pixel matrix, j=2,3,4,…,N.
[0155] Step 304: The transformed pixel values of the first row, the transformed pixel values of the first column, and the transformed other pixel values compose an initial ciphertext image.
[0156] It should be noted that in an embodiment of the present invention, after obtaining the transformed first row pixel values, the transformed first column pixel values and the other transformed pixel values, the transformed first row pixel values, the transformed first column pixel values and the other transformed pixel values together constitute the initial ciphertext image.
[0157] The present invention adopts the target chaotic sequence matrix as the transformation matrix, and then uses the transformation matrix to transform each pixel value in the encrypted image, thereby utilizing the randomness and unpredictability of the target chaotic sequence matrix, further enhancing the randomness and unpredictability of the pixel value transformation, and improving the encryption strength of the image.
[0158] Furthermore, in the embodiment of the present invention, step 104 may also include the following steps:
[0159] The scrambled matrices are sequentially truncated to obtain scrambled sequences, wherein the length of the scrambled sequence is the same as the number of pixels in the initial ciphertext image.
[0160] Decompose the pixels in the initial ciphertext image into multiple binary bit planes.
[0161] Each binary bit plane is divided to obtain a plurality of sub-blocks, wherein the number of sub-blocks in each binary bit plane is the same as the number of pixels in the initial ciphertext image.
[0162] For any sub-block in any binary bit plane, obtain the binary bit plane number where the sub-block is located and the position of the sub-block in the binary bit plane.
[0163] Any scrambled sequence is used as a binary bit plane number determination sequence, and the first target binary bit plane number is determined according to the binary bit plane number of the sub-block, a preset value, the position of the sub-block in the binary bit plane and the binary bit plane number determination sequence.
[0164] Any scrambled sequence except the binary bit plane number determination sequence is used as a position determination sequence, and the first target position is determined according to the number of the binary bit plane where the sub-block is located, the preset value, the position of the sub-block in the binary bit plane and the position determination sequence.
[0165] The sub-blocks at the first target position in the first target binary bit plane number are permuted with the sub-blocks to obtain a plurality of scrambled binary bit planes.
[0166] Multiple scrambled binary bit planes are synthesized to obtain an encrypted image.
[0167] It should be noted that, in the embodiment of the present invention, the scrambled matrix is sequentially intercepted to obtain a scrambled sequence, wherein the length of the scrambled sequence is the same as the number of pixels in the initial ciphertext image. For example, if the number of pixels in the initial ciphertext image is M×N, the length of the scrambled sequence is also M×N. The scrambled sequence includes a binary bit plane number determination sequence and a position determination sequence. The binary bit plane number determination sequence can be expressed as Y1=[y1,y2,…,y MxN ], the position determination sequence can be expressed as Z1 = [z1, z2, …, z MxN ].
[0168] The pixels in the initial ciphertext image are decomposed into multiple binary bit planes by BBD (Binary Bit-Plane Decomposition). The multiple binary bit planes can be 8 binary bit planes, such as Figure 4As shown, the 8 binary bit planes are represented as B={b0, b1, ..., b7,), where b0, b1, ..., b7 represent different binary bit planes, and 0, 1 ..., 7 represent different binary bit plane numbers.
[0169] Each binary bit plane is divided into multiple sub-blocks, where the number of sub-blocks in each binary bit plane is the same as the number of pixels in the initial ciphertext image. For example, if the number of pixels in the initial ciphertext image is M×N, Figure 4 As shown, the number of sub-blocks in each binary bit plane is M×N, denoted as b(i,j), where i is the number of the binary bit plane, i=0,1,…,7, and j is the number of the sub-block in the binary bit plane, j=1,2,…,M×N.
[0170] For any sub-block in any binary bit plane, obtain the binary bit plane number where the sub-block is located and the position of the sub-block in the binary bit plane.
[0171] Use any scrambled sequence as a binary bit plane number determination sequence, determine the first target binary bit plane number according to the binary bit plane number of the sub-block, the preset value, the position of the sub-block in the binary bit plane, and the binary bit plane number determination sequence, wherein the preset value may be 16, specifically, the first target binary bit plane number = the binary bit plane number of the sub-block * 16 + the position of the sub-block in the binary bit plane + the binary bit plane number determination sequence.
[0172] Any scrambled sequence except the binary bit plane number determination sequence is used as the position determination sequence, and the first target position is determined according to the number of the binary bit plane where the sub-block is located, the preset value, the position of the sub-block in the binary bit plane and the position determination sequence. Specifically, the first target position = the number of the binary bit plane where the sub-block is located * 16 + the position of the sub-block in the binary bit plane + the position determination sequence.
[0173] The sub-block at the first target position in the first target binary bit-plane number is replaced with the sub-block.
[0174] Specifically, according to formula (6), the current sub-block b(i, j) and the sub-block b(i*16+j+Y j , i*16+j+Z j ) to perform position replacement.
[0175]
[0176] Where b(i,j) is the jth sub-block in the binary bit plane number i, i is the binary bit plane number, that is, the binary bit plane number where the sub-block is located, i = 0, 1, ..., 7, j is the sub-block number in the binary bit plane, that is, the position of the sub-block in the binary bit plane, j = 1, 2, ..., M × N, Y j Determine the jth value in the sequence Y1 for the binary bit plane number, Z j Determine the jth value in the sequence Z1 for the position.
[0177] After completing the position permutation according to formula (6) for any sub-block in any binary bit plane, multiple scrambled binary bit planes can be obtained. The multiple scrambled binary bit planes are synthesized to obtain an encrypted image.
[0178] The present invention can effectively resist differential attacks by adopting binary bit plane decomposition and scrambling sequence scrambling operations. Even if the attacker obtains part of the plaintext and ciphertext pairs, it is difficult to derive the complete scrambling sequence, thereby making it difficult to crack the encrypted image.
[0179] Furthermore, in the embodiment of the present invention, the method may further include the following steps:
[0180] The pixels in the encrypted image are positionally inversely scrambled according to at least two scrambling matrices to obtain an initial plaintext image.
[0181] Each pixel value in the initial plaintext image is inversely transformed according to the transformation matrix to obtain the decrypted image.
[0182] It should be noted that, in the embodiment of the present invention, after obtaining the encrypted image, if the encrypted image is to be decrypted, the pixels in the encrypted image may be positionally inversely scrambled according to at least two scrambling matrices to obtain an initial plaintext image. After obtaining the initial plaintext image, each pixel value in the initial plaintext image is inversely transformed according to the transformation matrix to obtain a decrypted image.
[0183] The present invention uses the same scrambling matrix as in the encryption process to perform a position inverse scrambling operation on the encrypted image. Since the scrambling matrix has good randomness and unpredictability, it can accurately restore the original arrangement order of the image pixels, thereby ensuring the accuracy of the decryption process. In addition, the present invention uses the same transformation matrix as in the encryption process to perform an inverse transformation operation on the initial plaintext image. Since the transformation matrix is generated according to a chaotic sequence, it has good randomness and unpredictability, and can accurately restore the original values of the image pixels, thereby ensuring the accuracy of the decryption process.
[0184] Further, in the embodiment of the present invention, the step of “performing position inverse scrambling of pixels in the encrypted image according to at least two scrambling matrices to obtain an initial plaintext image” may also include the following steps:
[0185] Decompose the pixels in the encrypted image into multiple binary bit planes.
[0186] Each binary bit plane is divided to obtain a plurality of sub-blocks, wherein the number of sub-blocks in each binary bit plane is the same as the number of pixels in the encrypted image.
[0187] For any sub-block in any binary bit plane, obtain the binary bit plane number where the sub-block is located and the position of the sub-block in the binary bit plane.
[0188] The second target binary bit plane number is determined according to the binary bit plane number where the sub-block is located, a preset value, the position of the sub-block in the binary bit plane, and the binary bit plane number determination sequence.
[0189] The second target position is determined according to the number of the binary bit plane where the sub-block is located, the preset value, the position of the sub-block in the binary bit plane, and the position determination sequence.
[0190] Permuting the sub-blocks at the second target position in the second target binary bit plane number with the sub-blocks to obtain a plurality of inversely perturbed binary bit planes;
[0191] Multiple inverse scrambled binary bit planes are synthesized to obtain the initial plaintext image.
[0192] It should be noted that, in the embodiment of the present invention, the pixels in the encrypted image are decomposed into multiple binary bit planes by BBD (Binary Bit-Plane Decomposition). The multiple binary bit planes may be 8 binary bit planes, such as Figure 4 As shown, the 8 binary bit planes are represented as B={b0, b1, ..., b7,), where b0, b1, ..., b7 represent different binary bit planes, and 0, 1 ..., 7 represent different binary bit plane numbers.
[0193] Each binary bit plane is divided to obtain a plurality of sub-blocks, wherein the number of sub-blocks in each binary bit plane is the same as the number of pixels in the encrypted image.
[0194] For any sub-block in any binary bit plane, obtain the binary bit plane number where the sub-block is located and the position of the sub-block in the binary bit plane.
[0195] The second target binary bit plane number is determined according to the binary bit plane number of the sub-block, the preset value, the position of the sub-block in the binary bit plane and the binary bit plane number determination sequence, wherein the preset value may be 16, specifically, the second target binary bit plane number = (binary bit plane number of the sub-block - binary bit plane number determination sequence - position of the sub-block in the binary bit plane) / 16.
[0196] The second target position is determined based on the number of the binary bit plane where the sub-block is located, the preset value, the position of the sub-block in the binary bit plane, and the position determination sequence. Specifically, the second target position = (binary bit plane number where the sub-block is located - position determination sequence - position of the sub-block in the binary bit plane) / 16.
[0197] The sub-block at the second target position in the second target binary bit-plane number is replaced with the sub-block.
[0198] Specifically, according to formula (6), the current sub-block b(i,j) and the sub-block b((i'-Y j -j') / 16, (i'-Z j -j') / 16) for positional permutation.
[0199]
[0200] Wherein, b(i', j') is the j'th sub-block in the binary bit plane number i', i' is the number of the binary bit plane, that is, the binary bit plane number where the sub-block is located, i' = 0, 1, ..., 7, j' is the number of the sub-block in the binary bit plane, that is, the position of the sub-block in the binary bit plane, j' = 1, 2, ..., M × N, Y j Determine the jth value in the sequence Y1 for the binary bit plane number, Z j Determine the jth value in the sequence Z1 for the position.
[0201] After completing the position permutation according to formula (7) for any sub-block in any binary bit plane, multiple inversely scrambled binary bit planes can be obtained. The multiple inversely scrambled binary bit planes are synthesized to obtain the initial plaintext image.
[0202] The present invention performs a position inverse scrambling operation on the encrypted image by using the same scrambling matrix as that in the encryption process. Since the scrambling matrix has good randomness and unpredictability, the original arrangement order of the image pixels can be accurately restored, thereby ensuring the accuracy of the decryption process.
[0203] Furthermore, in the embodiment of the present invention, the step of “performing an inverse transformation on each pixel value in the initial plaintext image according to the transformation matrix to obtain a decrypted image” may also include the following steps:
[0204] The first row of pixel values in the initial plaintext image is inversely transformed according to the transformation matrix to obtain the first row of pixel values after inverse transformation.
[0205] It should be noted that, in the embodiment of the present invention, the first row of pixel values in the pixel matrix of the initial plaintext image is inversely transformed according to the transformation matrix to obtain the first row of pixel values after inverse transformation.
[0206] The first column of pixel values in the initial plaintext image is inversely transformed according to the transformation matrix to obtain the first column of pixel values after inverse transformation.
[0207] It should be noted that, in the embodiment of the present invention, the first column of pixel values in the pixel matrix of the initial plaintext image is inversely transformed according to the transformation matrix to obtain the first column of pixel values after inverse transformation. Specifically, each pixel value in the first column of pixel values is transformed according to formula (4) to obtain the transformed first column of pixel values, that is, A'(i,1) is converted into P'(i,1).
[0208] P'(i,1)=256–mod(A'(i,1)+X(i,1)+A'(i-1,1),256) Formula (8)
[0209] Among them, P'(i,1) is the first column pixel value after inverse transformation, A'(i,1) is the pixel value of the i-th row and the first column in the pixel matrix, X(i,1) is the value corresponding to the coordinate (i,1) in the transformation matrix, A'(i-1,1) is the pixel value of the i-1th row and the first column in the pixel matrix, i is the row number in the pixel matrix, i=2,3,4,…,M.
[0210] According to the transformation matrix, other pixel values in the initial plaintext image except the first row pixel value and the first column pixel value are inversely transformed to obtain other pixel values after inverse transformation.
[0211] The first row of pixel values after inverse transformation, the first column of pixel values after inverse transformation, and other pixel values after inverse transformation constitute the decrypted image.
[0212] It should be noted that, in the embodiment of the present invention, the pixel values other than the first row pixel values and the first column pixel values in the pixel matrix of the initial plaintext image are transformed according to the transformation matrix to obtain the other pixel values after inverse transformation. Specifically, the pixel values other than the first row pixel values and the first column pixel values are inversely transformed according to formula (9) to obtain the other pixel values after inverse transformation.
[0213] P'(i,j)=256-mod(A'(i,j)+A'(i-1,j)+A'(i,j-1)+X(i,j), 256) formula (9)
[0214] Among them, P'(i,j) is the other pixel value after inverse transformation, A'(i,j) is the pixel value of the i-th row and j-th column in the pixel matrix, A'(i-1,j) is the pixel value of the i-1-th row and j-th column in the pixel matrix, A'(i,j-1) is the pixel value of the i-th row and j-1-th column in the pixel matrix, X(i,j) is the value corresponding to the coordinate (i,j) in the transformation matrix, i is the row in the pixel matrix, i=2,3,4,…,M, j is the column in the pixel matrix, j=2,3,4,…,N.
[0215] The first row of pixel values after inverse transformation, the first column of pixel values after inverse transformation, and other pixel values after inverse transformation together constitute the decrypted image.
[0216] The present invention performs an inverse transformation operation on the initial plaintext image by using the same transformation matrix as that in the encryption process. Since the transformation matrix is generated according to a chaotic sequence, it has good randomness and unpredictability and can accurately restore the original values of the image pixels, thereby ensuring the accuracy of the decryption process.
[0217] Further, in the embodiment of the present invention, the step of “performing an inverse transformation on the first row of pixel values in the initial plaintext image according to the transformation matrix to obtain the inverse transformed first row of pixel values” may also include the following steps:
[0218] The first pixel value in the first row of the initial plaintext image is inversely transformed according to the transformation matrix to obtain the first pixel value in the first row after inverse transformation.
[0219] The pixel values other than the first pixel value in the first row of the initial plaintext image are inversely transformed according to the transformation matrix to obtain the other pixel values in the first row after inverse transformation.
[0220] The first pixel value after inverse transformation in the first row and the other pixel values after inverse transformation in the first row constitute the first row pixel values after inverse transformation.
[0221] It should be noted that, in the embodiment of the present invention, the first row of pixel values in the pixel matrix of the initial plaintext image is inversely transformed according to the transformation matrix to obtain the first row of pixel values after inverse transformation. Specifically, the first pixel value in the first row of pixel values is transformed according to formula (10) to obtain the first pixel value in the first row of pixel values after inverse transformation. The pixel matrix of the initial plaintext image can be represented by A'.
[0222] P'(1,1)=256–mod(A'(1,1),256) Formula (10)
[0223] Among them, P'(1,1) is the first pixel value after inverse transformation in the first row of pixel values, and A'(1,1) is the first pixel value in the first row of pixel values.
[0224] According to formula (11), the other pixel values in the first row of pixel values except the first pixel value are inversely transformed to obtain the other pixel values in the first row of pixel values after inverse transformation.
[0225] P'(1,j)=256–mod(X(1,j)+A'(1,j-1),256) Formula (11)
[0226] Among them, P'(1,j) is the other pixel values after inverse transformation in the first row of pixel values, X(1,j) is the value corresponding to the coordinate (1,j) in the transformation matrix, A'(1,j-1) is the other pixel values in the first row of pixel values except the first pixel value, j is the pixel value in the first row of pixel values, j=2,3,4,…,N.
[0227] After obtaining the first pixel value after inverse transformation in the first row and other pixel values after inverse transformation in the first row, the first pixel value after inverse transformation in the first row and other pixel values after inverse transformation in the first row constitute the first row of pixel values after inverse transformation.
[0228] The present invention performs an inverse transformation on the first pixel value in the first row, and then performs an inverse transformation on other pixel values in the first row except the first pixel value. This step-by-step inverse transformation method can accurately restore the original value of each pixel value, thereby ensuring the accuracy of the decryption process.
[0229] According to an embodiment of the present invention, there is also provided an image encryption device, referring to Figure 5 , Figure 5 : is a device block diagram of an image encryption device provided by an embodiment of the present invention, the image encryption device comprising:
[0230] The data acquisition module 501 is used to acquire a target chaotic sequence matrix and the size of the image to be encrypted, wherein the target chaotic sequence matrix is obtained based on the Lorentz chaotic system;
[0231] A pixel value extraction module 502 is used to extract pixel values of the image to be encrypted to obtain a pixel matrix of the image to be encrypted, wherein the pixel matrix of the image to be encrypted has the same size as the image to be encrypted;
[0232] The pixel value diffusion module 503 is used to use any target chaotic sequence matrix as a transformation matrix, and transform each pixel value in the pixel matrix according to the transformation matrix to obtain an initial ciphertext image;
[0233] The pixel scrambling module 504 is used to use the target chaotic sequence matrix other than the at least two transformation matrices as a scrambling matrix, and scramble the positions of the pixels in the initial ciphertext image according to the at least two scrambling matrices to obtain an encrypted image.
[0234] Optionally, the data acquisition module includes:
[0235] A key sequence acquisition submodule is used to acquire at least three sets of key sequences and state equations of the Lorentz chaotic system;
[0236] A key sequence segmentation submodule, used to segment the key sequence according to a preset number of bits to obtain at least three groups of segmented key sequences, wherein each group of segmented key sequences includes a plurality of sub-key sequences;
[0237] A key sequence average value determination submodule, used to determine the average value of the key sequence according to the segmented key sequence and the number of subkey sequences included in the segmented key sequence;
[0238] The chaotic system initial value determination submodule is used to determine the initial value corresponding to any group of segmented key sequences according to the segmented key sequences and the average value of the key sequences, and obtain at least three initial values of the Lorenz chaotic system;
[0239] A chaotic sequence matrix determination submodule is used to determine at least three chaotic sequence matrices respectively according to at least three initial values and the state equation of the Lorentz chaotic system;
[0240] The target chaotic sequence matrix determination submodule is used to perform matrix interception on the chaotic sequence matrix to obtain the target chaotic sequence matrix, wherein the target chaotic sequence matrix has the same size as the pixel matrix of the image to be encrypted.
[0241] Optionally, the pixel value diffusion module includes:
[0242] A first pixel value diffusion submodule, used for transforming the first row of pixel values in the pixel matrix according to the transformation matrix to obtain the transformed first row of pixel values;
[0243] A second pixel value diffusion submodule is used to transform the first column of pixel values in the pixel matrix according to the transformation matrix to obtain the transformed first column of pixel values;
[0244] A third pixel value diffusion submodule is used to transform other pixel values in the pixel matrix except the first row pixel value and the first column pixel value according to the transformation matrix to obtain other transformed pixel values;
[0245] The initial ciphertext image determination submodule is used to form an initial ciphertext image with the transformed first row pixel values, the transformed first column pixel values and other transformed pixel values.
[0246] Optionally, the pixel scrambling module includes:
[0247] A sequence interception submodule is used to perform sequence interception on the scrambled matrix to obtain a scrambled sequence, wherein the length of the scrambled sequence is the same as the number of pixels in the initial ciphertext image;
[0248] A first pixel decomposition submodule, used for decomposing pixels in the initial ciphertext image into a plurality of binary bit planes;
[0249] A first binary bit plane division submodule is used to divide each binary bit plane into multiple sub-blocks, wherein the number of sub-blocks in each binary bit plane is the same as the number of pixels in the initial ciphertext image;
[0250] A first sub-block data acquisition sub-module is used to acquire, for any sub-block in any binary bit plane, the binary bit plane number where the sub-block is located and the position of the sub-block in the binary bit plane;
[0251] A first target binary bit plane number determination submodule, configured to use any scrambled sequence as a binary bit plane number determination sequence, and determine a first target binary bit plane number according to the binary bit plane number of the sub-block, a preset value, the position of the sub-block in the binary bit plane, and the binary bit plane number determination sequence;
[0252] A first target position determination submodule, configured to use any scrambled sequence other than the binary bit plane number determination sequence as a position determination sequence, and determine a first target position according to the number of the binary bit plane where the sub-block is located, a preset value, the position of the sub-block in the binary bit plane, and the position determination sequence;
[0253] A first position replacement submodule, used for performing position replacement of the sub-blocks with the sub-blocks at the first target position in the first target binary bit plane number to obtain a plurality of scrambled binary bit planes;
[0254] The first binary bit plane synthesis submodule is used to synthesize a plurality of scrambled binary bit planes to obtain an encrypted image.
[0255] Optionally, the device comprises:
[0256] A pixel inverse scrambling module, used to perform position inverse scrambling on pixels in the encrypted image according to at least two scrambling matrices to obtain an initial plaintext image;
[0257] The pixel value inverse diffusion module is used to perform an inverse transformation on each pixel value in the initial plaintext image according to the transformation matrix to obtain a decrypted image.
[0258] Optionally, the pixel descrambling module includes:
[0259] A second pixel decomposition submodule, used for decomposing pixels in the encrypted image into a plurality of binary bit planes;
[0260] A second binary bit plane division submodule is used to divide each binary bit plane into multiple sub-blocks, wherein the number of sub-blocks in each binary bit plane is the same as the number of pixels in the encrypted image;
[0261] A second sub-block data acquisition sub-module is used to acquire, for any sub-block in any binary bit plane, the binary bit plane number where the sub-block is located and the position of the sub-block in the binary bit plane;
[0262] A second target binary bit plane number determination submodule, used to determine a second target binary bit plane number according to the binary bit plane number where the sub-block is located, a preset value, the position of the sub-block in the binary bit plane, and a binary bit plane number determination sequence;
[0263] A second target position determination submodule, used to determine the second target position according to the number of the binary bit plane where the sub-block is located, a preset value, the position of the sub-block in the binary bit plane, and a position determination sequence;
[0264] A second position replacement submodule is used to replace the sub-blocks at the second target position in the second target binary bit plane number with the sub-blocks to obtain a plurality of inversely scrambled binary bit planes;
[0265] The second binary bit plane synthesis submodule is used to synthesize multiple inverse scrambled binary bit planes to obtain an initial plaintext image.
[0266] Optionally, the pixel value inverse diffusion module includes:
[0267] A first pixel value inverse diffusion submodule, used for inversely transforming the first row of pixel values in the initial plaintext image according to the transformation matrix to obtain the first row of pixel values after inverse transformation;
[0268] A second pixel value inverse diffusion submodule is used to perform an inverse transformation on the first column of pixel values in the initial plaintext image according to the transformation matrix to obtain the first column of pixel values after the inverse transformation;
[0269] A third pixel value inverse diffusion submodule is used to perform inverse transformation on other pixel values in the initial plaintext image except the first row pixel value and the first column pixel value according to the transformation matrix to obtain other pixel values after inverse transformation;
[0270] The decrypted image determination submodule is used to form a decrypted image with the first row pixel values after inverse transformation, the first column pixel values after inverse transformation and other pixel values after inverse transformation.
[0271] The embodiment of the present invention further provides an electronic device, such as Figure 6 As shown, it includes a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604.
[0272] Memory 603, used for storing computer programs;
[0273] The processor 601 is used to execute the program stored in the memory 603 to implement the following steps:
[0274] Obtaining a target chaotic sequence matrix and the size of the image to be encrypted, wherein the target chaotic sequence matrix is obtained based on a Lorentz chaotic system;
[0275] Extracting pixel values of the image to be encrypted to obtain a pixel matrix of the image to be encrypted, wherein the pixel matrix of the image to be encrypted has the same size as the image to be encrypted;
[0276] Taking any target chaotic sequence matrix as a transformation matrix, transform each pixel value in the pixel matrix according to the transformation matrix to obtain the initial ciphertext image;
[0277] The target chaotic sequence matrix other than the at least two transformation matrices is used as a scrambling matrix, and the pixels in the initial ciphertext image are scrambled according to the at least two scrambling matrices to obtain an encrypted image.
[0278] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0279] The communication interface is used for communication between the above terminal and other devices.
[0280] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0281] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0282] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the computer-readable storage medium is run on a computer, the computer executes the image encryption method described in any one of the above embodiments.
[0283] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Sol logo State Disk (SSD)), etc.
[0284] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0285] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0286] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. An image encryption method, It is characterized in that The method comprises: Obtaining a target chaotic sequence matrix and a size of an image to be encrypted, wherein the target chaotic sequence matrix is obtained based on a Lorentz chaotic system; Extracting pixel values of the image to be encrypted to obtain a pixel matrix of the image to be encrypted, wherein the pixel matrix of the image to be encrypted has the same size as the image to be encrypted; Taking any of the target chaotic sequence matrices as a transformation matrix, transforming each pixel value in the pixel matrix according to the transformation matrix to obtain an initial ciphertext image; The target chaotic sequence matrix other than at least two of the transformation matrices is used as a scrambling matrix, and the pixels in the initial ciphertext image are scrambled according to the at least two scrambling matrices to obtain an encrypted image.
2. The method according to claim 1, It is characterized in that The obtaining of the target chaotic sequence matrix comprises: Obtain at least three sets of key sequences and state equations of the Lorentz chaotic system; Segmenting the key sequence according to a preset number of bits to obtain at least three groups of segmented key sequences, wherein each group of segmented key sequences includes a plurality of sub-key sequences; Determining an average value of the key sequence according to the segmented key sequence and the number of the subkey sequences included in the segmented key sequence; For any group of the segmented key sequences, determine the initial value corresponding to any group of the segmented key sequences according to the segmented key sequences and the average value of the key sequences, and obtain at least three initial values of the Lorenz chaotic system; Determine at least three chaotic sequence matrices respectively according to at least three initial values and the state equation of the Lorentz chaotic system; Matrix interception is performed on the chaotic sequence matrix respectively to obtain a target chaotic sequence matrix, wherein the target chaotic sequence matrix has the same size as the pixel matrix of the image to be encrypted.
3. The method according to claim 1, It is characterized in that The transforming each pixel value in the pixel matrix according to the transformation matrix to obtain an initial ciphertext image comprises: Transform the first row of pixel values in the pixel matrix according to the transformation matrix to obtain transformed first row of pixel values; Transform the first column of pixel values in the pixel matrix according to the transformation matrix to obtain transformed first column of pixel values; Transform other pixel values in the pixel matrix except the first row pixel value and the first column pixel value according to the transformation matrix to obtain the transformed other pixel values; The transformed first row pixel values, the transformed first column pixel values, and the transformed other pixel values constitute an initial ciphertext image.
4. The method according to claim 1, It is characterized in that The step of scrambling the pixels in the initial ciphertext image according to at least two scrambling matrices to obtain an encrypted image comprises: Sequentially intercepting the scrambled matrices respectively to obtain scrambled sequences, wherein the length of the scrambled sequences is the same as the number of pixels in the initial ciphertext image; Decomposing pixels in the initial ciphertext image into a plurality of binary bit planes; Dividing each of the binary bit planes to obtain a plurality of sub-blocks, wherein the number of the sub-blocks in each of the binary bit planes is the same as the number of pixels in the initial ciphertext image; For any of the sub-blocks in any of the binary bit planes, obtaining a binary bit plane number where the sub-block is located and a position of the sub-block in the binary bit plane; Taking any one of the scrambled sequences as a binary bit plane number determination sequence, determining a first target binary bit plane number according to the binary bit plane number of the sub-block, a preset value, the position of the sub-block in the binary bit plane, and the binary bit plane number determination sequence; Using any of the scrambled sequences except the binary bit plane number determination sequence as a position determination sequence, and determining a first target position according to the number of the binary bit plane where the sub-block is located, the preset value, the position of the sub-block in the binary bit plane, and the position determination sequence; Permuting the position of the sub-block at the first target position in the first target binary bit plane number with the sub-block to obtain a plurality of scrambled binary bit planes; The plurality of scrambled binary bit planes are synthesized to obtain an encrypted image.
5. The method according to claim 4, It is characterized in that After the step of scrambling the pixels in the initial ciphertext image according to at least two scrambling matrices to obtain an encrypted image, the method comprises: Performing position inverse scrambling on pixels in the encrypted image according to at least two scrambling matrices to obtain an initial plaintext image; Perform an inverse transformation on each pixel value in the initial plaintext image according to the transformation matrix to obtain a decrypted image.
6. The method according to claim 5, It is characterized in that The performing position inverse scrambling of pixels in the encrypted image according to at least two scrambling matrices to obtain an initial plaintext image comprises: Decomposing pixels in the encrypted image into a plurality of binary bit planes; Dividing each of the binary bit planes to obtain a plurality of sub-blocks, wherein the number of the sub-blocks in each of the binary bit planes is the same as the number of pixels in the encrypted image; For any of the sub-blocks in any of the binary bit planes, obtaining a binary bit plane number where the sub-block is located and a position of the sub-block in the binary bit plane; Determine a second target binary bit plane number according to the binary bit plane number of the sub-block, the preset value, the position of the sub-block in the binary bit plane, and the binary bit plane number determination sequence; Determine a second target position according to the number of the binary bit plane where the sub-block is located, the preset value, the position of the sub-block in the binary bit plane, and the position determination sequence; Permuting the sub-block at the second target position in the second target binary bit plane number with the sub-block to obtain a plurality of inversely permuted binary bit planes; The multiple inversely scrambled binary bit planes are synthesized to obtain an initial plaintext image.
7. The method according to claim 6, It is characterized in that The inverse transformation of each pixel value in the initial plaintext image according to the transformation matrix to obtain a decrypted image comprises: Performing an inverse transformation on the first row of pixel values in the initial plaintext image according to the transformation matrix to obtain the first row of pixel values after inverse transformation; Performing an inverse transformation on the first column of pixel values in the initial plaintext image according to the transformation matrix to obtain the first column of pixel values after inverse transformation; Performing an inverse transformation on other pixel values in the initial plaintext image except the first row pixel value and the first column pixel value according to the transformation matrix to obtain the other pixel values after inverse transformation; The first row of pixel values after inverse transformation, the first column of pixel values after inverse transformation, and the other pixel values after inverse transformation constitute a decrypted image.
8. An image encryption device, It is characterized in that The image encryption device comprises: A data acquisition module, used to acquire a target chaotic sequence matrix and the size of an image to be encrypted, wherein the target chaotic sequence matrix is obtained based on a Lorentz chaotic system; A pixel value extraction module, used for extracting pixel values of the image to be encrypted to obtain a pixel matrix of the image to be encrypted, wherein the pixel matrix of the image to be encrypted has the same size as the image to be encrypted; A pixel value diffusion module, used for taking any of the target chaotic sequence matrices as a first target chaotic sequence matrix, transforming each pixel value in the pixel matrix according to the first target chaotic sequence matrix, and obtaining an initial ciphertext image; The pixel scrambling module is used to use the target chaotic sequence matrix other than at least two of the transformation matrices as a scrambling matrix, and scramble the positions of the pixels in the initial ciphertext image according to at least two of the scrambling matrices to obtain an encrypted image.
9. An electronic device, It is characterized in that include: a memory for storing processor-executable instructions; The processor is configured to execute the instructions to implement the image encryption method as described in any one of claims 1 to 7.
10. A readable storage medium, It is characterized in that The readable storage medium stores a computer program, and when the computer program is executed by a processor, the image encryption method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Chaotic encryption and decryption method and system based on random weight
CN119544185A
A chaotic encryption and decryption method and system based on random weight
CN119544185B
Chaotic encryption and decryption method and system based on random weights
WO2026157147A1
