An image encryption method based on GAN and conditional normalization

By generating keys through a generative adversarial network and combining it with a conditional normalization layer, the problem of insufficient randomness in key generation in existing technologies is solved. This achieves expanded key space, enhanced anti-attack capability, and high robustness in the decryption process, making it suitable for secure transmission of various image formats.

CN123123513APending Publication Date: 2026-11-17CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611314002.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-27
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In existing image encryption technologies, key generation relies on fixed rules or simple chaotic systems, resulting in insufficient key randomness, obvious regularity, and insufficient security. The key space is also limited, making it easy to crack.

Method used

Generative Adversarial Networks (GANs) are used to generate keys, and the keys are deeply coupled with the features of the generator network through a conditional normalization layer. Encryption is performed by combining XOR operations and nonlinear mappings to achieve deep binding between the keys and image features.

Benefits of technology

It features a large key space, strong resistance to brute-force and statistical attacks, high key dependence in the decryption process, high robustness and integrated optimization capabilities, and is suitable for secure transmission of various image formats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123513A_ABST
    Figure CN123123513A_ABST
Patent Text Reader

Abstract

This disclosure presents an image encryption method based on GAN and conditional normalization, belonging to the field of image encryption technology. The method includes: preprocessing the original image to obtain an image to be encrypted; inputting the image to be encrypted into a generator in a generative adversarial network (GAN), where the generator generates a key bound to the image to be encrypted based on image features; performing an XOR operation on the image to be encrypted and the key, then inputting the result back into the generator for nonlinear mapping to obtain an encrypted image; and using a decryption network to perform an inverse decryption transformation on the encrypted image and the key to obtain a decrypted image. The generator includes a conditional normalization layer, and the key is dynamically generated through a fully connected layer, with scaling and offset factors injected into the conditional normalization layer, achieving deep coupling between the key and the generator network features. This disclosure achieves one key per image through image feature-driven adaptive key generation, expanding the key space, enhancing key randomness, and effectively resisting brute-force attacks, statistical analysis, and noise cropping attacks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Applications generally relate to the field of image encryption technology, and in particular to an image encryption method based on GAN and conditional normalization. Background Technology

[0002] With the widespread application of digital images in fields such as security monitoring, medical imaging, government data, and cloud platforms, the importance of image encryption technology is becoming increasingly prominent. Image encryption technology is used to protect the security of sensitive image information during transmission and storage, preventing information leakage.

[0003] In existing technologies, there are chaotic image encryption schemes that combine block scrambling and DNA encoding. This scheme uses chaotic sequences generated by a hyperchaotic system for inter-block index scrambling and intra-block scrambling, and further scrambles the image using the index sequence to enhance the encryption effect.

[0004] However, traditional image encryption algorithms primarily rely on fixed rules or simple chaotic systems for key generation. Fixed-rule key generation methods typically generate key sequences according to pre-defined mathematical formulas or logical processes in a specific order. For example, using fixed permutation or substitution rules, certain preset parameters are substituted into the formula, and the same computational logic is followed each time a key is generated, resulting in a certain degree of repetition in the generated keys. Once an attacker masters the rules, they can analyze the keys through reverse computation.

[0005] Key generation for simple chaotic systems often employs one-dimensional chaotic mappings, such as the Logistic mapping. Taking the Logistic mapping as an example, its expression is x. {n+1} =μx n (1 x n ), where μ is the control parameter, x n The value represents a chaotic sequence. In practical applications, a chaotic sequence is generated iteratively by setting initial values ​​and a μ value, and then processed and used as an encryption key. However, keys generated by one-dimensional chaotic systems have significant drawbacks: due to their relatively simple dynamic characteristics, they exhibit periodicity within a certain parameter range. Faced with targeted key analysis attacks, attackers can exploit the characteristics of chaotic systems to deduce system parameters and initial conditions through methods such as phase space reconstruction and Lyapunov exponent analysis, thereby cracking the key.

[0006] Furthermore, traditional key generation methods have limited key spaces, making it difficult to meet the growing demands for information security. When facing brute-force attacks, encrypted images have weak security protection because the range of keys that can be exhausted is relatively small. Therefore, existing technologies suffer from insufficient key randomness, obvious patterns, inadequate overall security, and limited key spaces. Summary of the Invention

[0007] This disclosure addresses some of the shortcomings mentioned in the background art by providing an image encryption method based on GAN and conditional normalization.

[0008] In a first aspect, embodiments of this disclosure provide an image encryption method based on GAN and conditional normalization, comprising the following steps: The original image is preprocessed to obtain the image to be encrypted; The image to be encrypted is input into the generator in a pre-trained generative adversarial network, and the generator generates a key bound to the image to be encrypted based on the image features of the image to be encrypted; The image to be encrypted is XORed with the key, and the result of the XOR operation is input into the generator for nonlinear mapping to obtain the encrypted image. The generator includes at least one conditional normalization layer. The key is dynamically generated by a scaling factor and an offset factor through a fully connected layer and injected into the conditional normalization layer to deeply couple the key with the network features of the generator.

[0009] In one embodiment of the first aspect, the step of preprocessing the original image to obtain the image to be encrypted further includes: The original image is formatted uniformly; The pixel values ​​of the original image after format unification are normalized to a preset range; The normalized original image is divided into multiple image blocks according to a preset size to obtain the image to be encrypted, wherein the image blocks do not overlap with each other.

[0010] In one embodiment of the first aspect, the step of generating a key bound to the image to be encrypted by the generator based on the image features of the image to be encrypted further includes: Extract global or deep features from the image to be encrypted; The global features or the deep features are input into the generator; The generator outputs a key image with the same size as the image to be encrypted, which is used as the key. Different original images correspond to different keys.

[0011] In one embodiment of the first aspect, the generator includes a convolutional layer, a residual block, and a transposed convolutional upsampling layer; The key is used to generate a condition vector through a fully connected mapping network; The conditional vector generates the scaling factor and the offset factor through the fully connected layer; The conditional normalization layer is inserted after each network layer of the generator. The conditional normalization layer normalizes and transforms the output features of the network layer according to the scaling factor and the offset factor.

[0012] In one embodiment of the first aspect, the step of performing an XOR operation on the image to be encrypted and the key, and inputting the result of the XOR operation into the generator for nonlinear mapping to obtain the encrypted image, further includes: Each image block is XORed with the corresponding pixel in the key to obtain an XOR image block; The XOR image block is input into the generator for nonlinear mapping to obtain an encrypted image block; By stitching together all the encrypted image blocks, the encrypted image is obtained.

[0013] In one embodiment of the first aspect, it further includes: The encrypted image and the key are decrypted using a decryption network to obtain the decrypted image; The decryption network adopts an inverse structure symmetrical to the generator, and the decryption network and the generator are jointly trained. If the input key is inconsistent with the key used during encryption during decryption, the decryption network outputs a noisy image.

[0014] In one embodiment of the first aspect, the generative adversarial network further includes a discriminant network; the discriminant network is used to receive the original image or the encrypted image and output a judgment probability; the generator and the discriminant network are optimized through adversarial training.

[0015] In one embodiment of the first aspect, the training loss of the generative adversarial network includes adversarial loss, reconstruction loss, and attention enhancement loss; The adversarial loss is determined based on the judgment results of the discriminant network on the original image and the encrypted image; The reconstruction loss is determined based on the difference between the decrypted image and the original image; The attention enhancement loss is determined based on the difference between the pixel values ​​of sensitive regions in the encrypted image and the mean of their local neighborhoods.

[0016] In one embodiment of the first aspect, the attention enhancement loss is further determined by weighting the difference between the pixel values ​​of the sensitive region in the encrypted image and the mean of its local neighborhood, based on an attention map obtained in advance by a saliency detection network.

[0017] In one embodiment of the first aspect, the training process of the generative adversarial network includes: The first and second optimization steps are executed alternately until the preset convergence condition is met. The first optimization step includes fixing the generator and optimizing the decryption network to minimize the reconstruction loss; The second optimization step includes fixing the decryption network and optimizing the generator to minimize the adversarial loss and the attention enhancement loss.

[0018] This disclosure proposes an image encryption method based on GAN and conditional normalization, which has the following beneficial effects: (1) Strong key randomness and large key space. This disclosure uses generative adversarial networks to generate keys strongly bound to images, overcoming the problems of insufficient key randomness and obvious regularity in fixed-rule or simple chaotic systems. Different images generate different keys, achieving a unified key space. Figure 1 The key space has been significantly expanded, enhancing its resistance to brute-force attacks.

[0019] (2) Strong resistance to statistical attacks. This disclosure adopts a feature space encryption transformation that combines XOR and nonlinear mapping. It does not rely on traditional pixel scrambling and can effectively change the statistical characteristics of the image, making the histogram of the encrypted image uniform and the correlation between adjacent pixels close to zero, thereby resisting statistical attacks.

[0020] (3) High key sensitivity. This disclosure injects the key into each network layer of the generator through a conditional normalization layer, achieving deep coupling between the key and the network features of the generator. During decryption, if the input key is inconsistent with the encryption key, the conditional normalization parameters are incorrect, the feature distribution shifts, and the decryption network outputs a completely noisy image, thus avoiding partial information leakage.

[0021] (4) High robustness against noise and pruning. This disclosure conducts joint adversarial training on the encryption and decryption networks to achieve integrated optimization of encryption and decryption, resulting in high decryption recovery accuracy and strong robustness against transmission impairments such as noise and pruning.

[0022] (5) High versatility. This disclosure supports multiple formats such as RGB images and grayscale images, and is suitable for the secure transmission and storage protection of various sensitive images in scenarios such as security monitoring, medical imaging, government data, and cloud platforms. Attached Figure Description

[0023] Figure 1 The flowchart below shows an image encryption method based on GAN and conditional normalization according to this disclosure. Figure 2 This is a schematic diagram of the encryption and decryption process of the generator according to Embodiment 1 of this disclosure. Detailed Implementation

[0024] The present application / disclosure will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application / disclosure and are not intended to limit the scope of the present application / disclosure. Furthermore, it should be noted that, for ease of description, only the parts relevant to the present application / disclosure are shown in the accompanying drawings, not the entire structure.

[0025] Example 1 Figure 1 To illustrate the image encryption method based on GAN and conditional normalization according to this disclosure, the following will refer to... Figure 1 This paper provides a detailed description of an image encryption method based on GAN and conditional normalization.

[0026] Step 101: Preprocess the original image to obtain the image to be encrypted.

[0027] In this embodiment, the original image is first format-unified by converting it to standard RGB or grayscale format. Then, the format-unified image is normalized, mapping pixel values ​​to the [0,1] interval. The normalization formula is: Formula 1 Where I(x,y) is the pixel value of the original image at coordinates (x,y), x∈[1,M], y∈[1,N], and M and N are the image width and height, respectively.

[0028] In one embodiment, the normalized image is divided into non-overlapping image blocks of size p×p, denoted as B. i,j Each image block is independent, and all image blocks together constitute the image to be encrypted. The purpose of image segmentation is to improve the efficiency of subsequent encryption and the diffusion effect.

[0029] Step 102: Input the image to be encrypted into the generator in the pre-trained Generative Adversarial Network (GAN), and the generator will generate a key bound to the image to be encrypted based on the image features of the image to be encrypted.

[0030] In this embodiment, before step 102, a generative adversarial network (GAN) needs to be constructed and trained. The GAN includes a generator and a discriminator.

[0031] In one embodiment, a generator G is constructed based on a convolutional neural network, comprising convolutional layers, deconvolutional layers, and a ReLU activation function. A conditional normalization layer is inserted after each network layer to achieve key coupling. The input to the generator is standard normal noise z and image patch depth features f(B). i,j The concatenated vector. The generator structure consists of a convolutional layer, four residual blocks, a transposed convolutional upsampling layer, and a Tanh output layer.

[0032] In one embodiment, a discriminator is constructed based on a convolutional neural network and fully connected layers, using a sigmoid function to output probability values. The input to the discriminator is either a raw image patch or an encrypted image patch. The discriminator has a 5-layer convolutional structure with a 4×4 kernel size and a stride of 2, using the LeakyReLU activation function. The last layer of the discriminator outputs a single numerical value, which represents the probability that the discriminator determines whether the input is a real image or an encrypted artifact.

[0033] In one embodiment, the training loss of the generative adversarial network includes adversarial loss, reconstruction loss, and attention enhancement loss.

[0034] In this embodiment, the adversarial loss is determined based on the discriminator's judgment results on the original image and the encrypted image. The adversarial loss is expressed as: Formula 2 Where G is the generator, D is the discriminator, x is the original image, and z is noise.

[0035] In this embodiment, the reconstruction loss is determined based on the difference between the decrypted image and the original image. The reconstruction loss is expressed as: Formula 3 Among them, I ori The image is the original image. Encode is the encryption process, Decode is the decryption process, and K is the key.

[0036] In this embodiment, the attention enhancement loss is determined based on the difference between the pixel values ​​of sensitive regions in the encrypted image and their local neighborhood mean. The attention enhancement loss is determined by weighting the differences between the pixel values ​​of sensitive regions in the encrypted image and their local neighborhood mean, based on an attention map pre-obtained through a saliency detection network. The saliency detection network can be U²-Net, and the attention map M is pre-computed. att The loss of attention enhancement is represented as: Formula 4 Among them, M att For attention graphs, I enc To encrypt the image, I mean Let M be the mean of the local neighborhood, and M and N be the image width and height, respectively.

[0037] The total training loss is: Formula 5 Where, λ rec and λ attn L represents the weighting coefficient. adv To combat losses; L rec To decipher the reconstruction loss; L attnThis is an attention enhancement loss based on saliency detection.

[0038] In one embodiment, the training process includes alternately executing a first optimization step and a second optimization step. The first optimization step involves fixing the generator and optimizing the decryption network to minimize the reconstruction loss, i.e., minimizing the difference between the decrypted image and the original image. The second optimization step involves fixing the decryption network and optimizing the generator to minimize the adversarial loss and attention enhancement loss. The first and second optimization steps are executed alternately until a preset convergence condition is met. Through iterative optimization, the generator and discriminator reach a stable equilibrium, ensuring that encrypted images are indistinguishable and decrypted images can be completely restored.

[0039] After the generative adversarial network (GAN) is trained, global or deep features of the image to be encrypted are extracted and input into the generator. The generator outputs a key image of the same size as the image to be encrypted, which serves as the key. The key is generated driven by the image features of the image to be encrypted; different original images correspond to different keys, thus achieving a... Figure 1 Key.

[0040] In step 103, an XOR operation is performed on the image to be encrypted and the key. The result of the XOR operation is then input into the generator for nonlinear mapping to obtain the encrypted image.

[0041] In one embodiment, such as Figure 2 As shown, for each image block, an XOR operation is performed between the image block and the corresponding pixel in the key to obtain an XOR image block. This XOR image block is then input into a generator for non-linear mapping to obtain an encrypted image block. All encrypted image blocks are concatenated to obtain the complete encrypted image. This process can be represented as: Formula 6 Among them, B i,j For the original image patch, K i,j G represents the corresponding pixel or key block in the key, and G is the generator. To encrypt image blocks.

[0042] The generator includes at least one conditional normalization layer. The key is processed by a fully connected mapping network to generate a conditional vector Z. k Conditional vector Z k Scaling factor γ and offset factor β are dynamically generated through a fully connected layer and injected into a conditional normalization layer. The conditional normalization layer normalizes and transforms the output features of the network layers, achieving deep coupling between the key and the generator network features. The conditional normalization transformation process is expressed as follows: Formula 7 Where F1 is the input feature of the conditional normalization layer, μ1 is the mean of the input features, σ1 is the standard deviation of the input features, and γ1 and β1 are the input features derived from the conditional vector Z.k Scaling and offset factors are dynamically generated through fully connected layers.

[0043] In one embodiment, the condition vector Z k The condition vector Z is obtained by passing the key tensor K output by the generator through a fully connected mapping network. k The dimension can be set to no less than 512.

[0044] In this embodiment, since the key is injected into each network layer of the generator through the conditional normalization layer, when the key changes, the conditional vector changes accordingly, and the generated scaling factor and offset factor also change accordingly, causing a shift in the normalized feature distribution. Therefore, an incorrect key cannot complete the correct normalization, and the decryption process directly fails. All encrypted blocks are concatenated to obtain the final encrypted image I.

[0045] Step 104: Use the decryption network to perform an inverse decryption transformation on the encrypted image and the key to obtain the decrypted image.

[0046] In this embodiment, a decryption network symmetrical to the encryption network is constructed. The decryption network adopts an inverse structure symmetrical to the generator, and the decryption network and generator are trained jointly, not separately. During decryption, the encrypted image and key are input into the decryption network, which performs an inverse decryption transformation on the encrypted image to obtain decrypted image blocks. All decrypted image blocks are stitched together and an inverse normalization operation is performed to output the original image without distortion.

[0047] In one embodiment, the training strategy for the decryption network includes: fixing the generator and optimizing the decryption network to reduce the reconstruction loss. Minimize; fix the decryption network and optimize the generator to minimize the adversarial loss. The end-to-end objective is D(E(I,K),K)≈I, where E is the encryption network, D is the decryption network, I is the original image, and K is the key.

[0048] In one embodiment, during decryption, the key is input into a fully connected layer to generate a scaling factor γ and an offset factor β. If the input key is inconsistent with the key used during encryption, the generated scaling and offset factors will differ from those used during encryption, causing a shift in the conditionally normalized feature distribution, resulting in the decryption network outputting a completely noisy image.

[0049] This disclosure provides an image encryption method based on GAN and conditional normalization, which realizes image feature-driven adaptive key generation, feature space composite encryption, deep coupling of conditional normalization keys, and integrated encryption and decryption adversarial optimization. It can effectively resist brute-force attacks, statistical analysis, noise and cropping attacks while ensuring that the decryption can completely restore the original image.

[0050] In a second aspect, embodiments of this disclosure provide an electronic device including a memory and a processor, wherein the memory stores a program that runs on the processor, and the processor, when running the program, performs the steps of an image encryption method based on GAN and conditional normalization as described in the first aspect. In a third aspect, embodiments of this disclosure provide a computer-readable storage medium having computer instructions stored thereon, which, when executed, perform the steps of an image encryption method based on GAN and conditional normalization as described in the first aspect.

Claims

1. An image encryption method based on GAN and conditional normalization, characterized in that, Includes the following steps: The original image is preprocessed to obtain the image to be encrypted; The image to be encrypted is input into the generator in a pre-trained generative adversarial network, and the generator generates a key bound to the image to be encrypted based on the image features of the image to be encrypted; The image to be encrypted is XORed with the key, and the result of the XOR operation is input into the generator for nonlinear mapping to obtain the encrypted image. The generator includes at least one conditional normalization layer. The key is dynamically generated by a scaling factor and an offset factor through a fully connected layer and injected into the conditional normalization layer to deeply couple the key with the network features of the generator.

2. The image encryption method based on GAN and conditional normalization according to claim 1, characterized in that, The step of preprocessing the original image to obtain the image to be encrypted further includes: The original image is formatted uniformly; The pixel values ​​of the original image after format unification are normalized to a preset range; The normalized original image is divided into multiple image blocks according to a preset size to obtain the image to be encrypted, wherein the image blocks do not overlap with each other.

3. The image encryption method based on GAN and conditional normalization according to claim 1, characterized in that, The step of generating a key bound to the image to be encrypted by the generator based on the image features of the image to be encrypted further includes: Extract global or deep features from the image to be encrypted; The global features or the deep features are input into the generator; The generator outputs a key image with the same size as the image to be encrypted, which is used as the key. Different original images correspond to different keys.

4. The image encryption method based on GAN and conditional normalization according to claim 1, characterized in that, The generator includes a convolutional layer, a residual block, and a transposed convolutional upsampling layer; The key is used to generate a condition vector through a fully connected mapping network; The conditional vector generates the scaling factor and the offset factor through the fully connected layer; The conditional normalization layer is inserted after each network layer of the generator. The conditional normalization layer normalizes and transforms the output features of the network layer according to the scaling factor and the offset factor.

5. The image encryption method based on GAN and conditional normalization according to claim 2, characterized in that, The step of performing an XOR operation on the image to be encrypted and the key, and inputting the result of the XOR operation into the generator for nonlinear mapping to obtain the encrypted image, further includes: Each image block is XORed with the corresponding pixel in the key to obtain an XOR image block; The XOR image block is input into the generator for nonlinear mapping to obtain an encrypted image block; By stitching together all the encrypted image blocks, the encrypted image is obtained.

6. The image encryption method based on GAN and conditional normalization according to claim 1, characterized in that, Also includes: The encrypted image and the key are decrypted using a decryption network to obtain the decrypted image; The decryption network adopts an inverse structure symmetrical to the generator, and the decryption network and the generator are jointly trained. If the input key is inconsistent with the key used during encryption during decryption, the decryption network outputs a noisy image.

7. The image encryption method based on GAN and conditional normalization according to claim 6, characterized in that, The generative adversarial network further includes a discriminant network; the discriminant network is used to receive the original image or the encrypted image and output a judgment probability; the generator and the discriminant network are optimized through adversarial training.

8. The image encryption method based on GAN and conditional normalization according to claim 7, characterized in that, The training loss of the generative adversarial network includes adversarial loss, reconstruction loss, and attention enhancement loss; The adversarial loss is determined based on the judgment results of the discriminant network on the original image and the encrypted image; The reconstruction loss is determined based on the difference between the decrypted image and the original image; The attention enhancement loss is determined based on the difference between the pixel values ​​of the sensitive regions in the encrypted image and the mean of their local neighborhoods.

9. The image encryption method based on GAN and conditional normalization according to claim 8, characterized in that, It also includes determining the attention enhancement loss by weighting the difference between the pixel values ​​of the sensitive region in the encrypted image and the mean of its local neighborhood, based on the attention map obtained in advance through a saliency detection network.

10. The image encryption method based on GAN and conditional normalization according to claim 8, characterized in that, The training process of the generative adversarial network includes: The first and second optimization steps are executed alternately until the preset convergence condition is met. The first optimization step includes fixing the generator and optimizing the decryption network to minimize the reconstruction loss; The second optimization step includes fixing the decryption network and optimizing the generator to minimize the adversarial loss and the attention enhancement loss.