CN-122027749-A - Chaotic image encryption method based on attention mechanism and filter
Abstract
The invention discloses a chaotic image encryption method based on an attention mechanism and a filter, which comprises the steps of input and pretreatment, self-attention feature extraction and key generation, chaotic system initialization and sequence generation, DNA coding encryption and dynamic three-dimensional filtering diffusion, wherein the decryption process is a strict inverse process of the encryption process, all parameters and sequences need to be reproduced by using the same key vector, and reverse substitution, reverse filtering diffusion and DNA decoding are sequentially carried out, so that an original image is finally restored in a lossless manner. The invention relates to the technical field of information security, which dynamically generates a secret key from image content by a self-attention mechanism and adopts a dynamic three-dimensional filtering diffusion mechanism to realize cooperative encryption and dynamic randomization processing on a three-dimensional structure of a color image, thereby obviously improving the security, diffusion and attack resistance of an encryption system.
Inventors
- XU CONG
- XIE JIEPING
- XU JIE
Assignees
- 长沙理工大学
Dates
- Publication Date
- 20260512
- Application Date
- 20260210
Claims (9)
- 1. The chaotic image encryption method based on the attention mechanism and the filter is characterized by comprising the following steps of: inputting an original color image, and adjusting the size of the original color image to be a multiple of 8 so as to facilitate blocking processing; Step two, self-attention feature extraction and key generation, namely carrying out block analysis on the image, calculating importance among blocks by utilizing a self-attention mechanism, selecting the features of key blocks to generate a key vector adaptive to the content of the image; Thirdly, initializing a chaotic system and generating a sequence, namely driving a two-dimensional Logistic chaotic map by using the key vector as a seed to generate a chaotic sequence with enough length; Step four, DNA coding encryption, namely converting an image pixel matrix and a chaotic matrix into binary strings, coding the binary strings into DNA sequences according to defined base mapping rules, and performing exclusive OR operation in a DNA domain to finish the first-layer encryption; Step five, dynamic three-dimensional filtering diffusion: a. the key and the filter are generated, namely a diffusion key is calculated by a key vector, and a dynamic three-dimensional filter pool and a pixel-level filter selection sequence are generated by a chaotic sequence; b. Image filling, namely asymmetrically filling the image after DNA encryption; c. Filtering and nonlinear diffusion, namely dynamically selecting a filter for each pixel according to a selection sequence, calculating a weighted sum of three-dimensional neighborhood of the filter, and carrying out nonlinear modulo addition operation by combining a diffusion key; d. Three-dimensional replacement, namely performing independent scrambling on three dimensions of a row, a column and a channel on the filtered image based on a chaotic sequence; and outputting to obtain the final ciphertext image.
- 2. The chaotic image encryption method based on the attention mechanism and the filter of claim 1, wherein the specific implementation of the second self-attention feature extraction and the key generation comprises the following steps: dividing an input image of size mxn×3 into a plurality of image blocks of size 8×8×3 that do not overlap each other; for each image block, calculating the mean, variance and entropy of the R, G, B channels of the image block, wherein each block is expressed as a 9-dimensional feature vector; Cosine similarity between every two image block feature vectors is calculated, the cosine similarity is converted into an attention weight matrix through an exponential function, and self-connection is removed; Calculating the importance score of each image block, namely the sum of the importance score and the attention weights of all other blocks, and selecting K blocks with the highest score as key blocks; and sequentially connecting and flattening the 9-dimensional feature vectors of the K key blocks to generate the key vector.
- 3. The chaotic image encryption method based on the attention mechanism and the filter of claim 1, wherein in the third step, the initial parameters of the chaotic system are derived by using the sum keySum of absolute values of key vectors: initial state x0=mod (keySum, 1), y0=mod (keySum/2, 1) Control parameters: , the iteration adopts a two-dimensional Logistic chaotic mapping formula: after each iteration pair , Taking the modulus 1 operation to ensure that the value range is in [0, 1); Discarding the first T transient points to eliminate transient effect, adding the remaining x and y sequences, taking the modulus 1 to obtain a composite chaotic sequence with better uniformity, and finally amplifying and quantifying the sequence, wherein C=floor (chaos _seq 10≡10) Mod 256, resulting in an integer chaotic sequence ranging from 0-255.
- 4. The chaotic image encryption method based on the attention mechanism and the filter according to claim 1, wherein in the fourth step, the base mapping rule adopted by the DNA coding is that binary 00 codes are base A,11 codes are T,01 codes are C and 10 codes are G, and the exclusive OR operation in the DNA domain is carried out according to a defined DNA exclusive OR operation table.
- 5. The chaotic image encryption method based on the attention mechanism and the filter according to claim 1, wherein in the step five a Diffusion key k_d calculation k_d=sum (abs (v_key)) mod 256 The dynamic three-dimensional filter pool comprises N_f filters with the size of 3 multiplied by 3, wherein the lower right corner element F_f (3, 3) of each filter is fixed to be 1, the other 26 coefficients are generated through a chaotic sequence, and the values are positive integers between 1 and 5 The filter dynamic selection sequence generates a filter index Select (i, j) = (C [ ((i-1)) for each spatial location (i, j) in the image N+j) mod L ] mod n_f) +1, where C is the chaotic sequence, N is the number of image columns, L is the sequence length, and n_f is the filter pool size.
- 6. The chaotic image encryption method based on the attention mechanism and the filter of claim 1, wherein in the step five c, the specific operation of three-dimensional filtering and nonlinear diffusion is as follows: For the pixels at positions (i, j, c) in the filled image, selecting a filter F according to Select (i-2, j-2); taking the pixel as the lower right corner, extracting a 3X 3 local region R, and calculating a filtering result: And combining the filtering result with the diffusion key to perform nonlinear modulo addition operation to generate a diffusion pixel value.
- 7. The chaotic image encryption method based on the attention mechanism and the filter of claim 1, wherein in the step five d, the specific operation of three-dimensional permutation is as follows: Respectively taking out three subsequences with lengths M, N and 3 from the chaotic sequence; sequencing the three subsequences to obtain sequencing indexes thereof, wherein the sequencing indexes are respectively used as row replacement indexes, column replacement indexes and channel replacement indexes; and sequentially performing row, column and channel replacement operation on the filtered and diffused image.
- 8. A system for implementing the attention mechanism and filter based chaotic image encryption method of any one of claims 1 to 7, comprising: The self-attention feature extraction and key generation module is used for converting the complexity of the image content into an initial key of the encryption system; the chaotic system initialization and sequence generation module is used for providing a pseudo-random source to drive the subsequent randomization operation; the DNA coding encryption module is used for introducing confusion at the biomolecule calculation level; and the dynamic three-dimensional filtering diffusion module is used for realizing the confusion and diffusion of the cross-channel through three-dimensional dynamic filtering and replacement.
- 9. An image decryption method for decrypting a ciphertext image encrypted by the method of any one of claims 1 to 7 is characterized in that the decryption process is a strict inverse process of an encryption process, all parameters and sequences need to be reproduced by using the same key vector, and inverse three-dimensional substitution, inverse filtering diffusion and DNA decoding are sequentially carried out, so that an original image is finally restored in a lossless manner.
Description
Chaotic image encryption method based on attention mechanism and filter Technical Field The invention relates to the technical field of information security, in particular to a chaotic image encryption method based on an attention mechanism and a filter. Background With the widespread use of digital images in the internet and multimedia, image information security issues are increasingly prominent. The existing image encryption technology mainly comprises the following categories: (1) Image encryption based on chaotic mapping, namely generating a pseudo-random sequence by utilizing a Logistic, henon one-dimensional or two-dimensional chaotic system and the like, and carrying out pixel-level position scrambling and value diffusion on the image. Some schemes introduce DNA encoding rules that operate on the DNA domain to increase the confusion. However, most of such methods treat RGB channels of color images as three independent two-dimensional planes, respectively, and fail to effectively destroy inherent high statistical correlation among channels, which results in limited encryption strength and is vulnerable to single-channel or inter-channel relations. (2) Image encryption based on frequency domain transformation and filtering, namely transforming the image into a frequency domain (such as DCT and DWT), applying a fixed or simple randomly generated filter to the frequency domain to scramble coefficients, and inversely transforming the coefficients back into a space domain. The filter design of such methods is typically static and the encryption mechanism lacks dynamic randomness. (3) And (3) image encryption based on SCAN language or cellular automaton, namely, using SCAN mode to define complex pixel traversal paths for scrambling or using fixed evolution rules of the cellular automaton for carrying out multi-round iterative transformation. Its rule set is typically limited, resulting in the encryption process being predictive. In summary, the prior art has two general core defects that firstly, the high-dimensional (three-dimensional) information of the color image is not utilized enough to realize the collaborative confusion and diffusion of the cross channels, and secondly, the encryption mechanism is static, and the capability of resisting differential attack and statistical attack is weak by adopting fixed transformation parameters or modes in the single encryption process. Therefore, there is a need for an image encryption method that can fully utilize the three-dimensional structure of a color image and introduce a dynamic randomization mechanism to improve security. Disclosure of Invention The invention aims to overcome the defects in the prior art and provides a chaotic image encryption method based on an attention mechanism and a filter. The method dynamically generates a secret key from the image content by a self-attention mechanism, and adopts a dynamic three-dimensional filtering diffusion mechanism to realize cooperative encryption and dynamic randomization processing on the three-dimensional structure of the color image, thereby remarkably improving the security, the diffusion and the attack resistance of the encryption system. In order to solve the technical problems, the invention provides the following technical scheme that the chaotic image encryption method based on the attention mechanism and the filter, which is provided by the scheme, comprises the following steps: Step one, input and pretreatment The original color image is input and its size is adjusted to a multiple of 8 to facilitate the blocking process. Step two, self-attention feature extraction and key generation And carrying out block analysis on the image, calculating importance among blocks by using a self-attention mechanism, and selecting characteristics of key blocks to generate a key vector adaptive to the content of the image. Step three, chaotic system initialization and sequence generation And driving a two-dimensional Logistic chaotic map by using the key vector as a seed to generate a chaotic sequence with a sufficient length. Step four, DNA coding encryption And converting the image pixel matrix and the chaotic matrix into binary strings, encoding the binary strings into a DNA sequence according to a defined base mapping rule, and performing exclusive OR operation in a DNA domain to complete the first-layer encryption. Step five, dynamic three-dimensional filtering diffusion: 1. and generating a key and a filter, namely calculating a diffusion key by using a key vector, and generating a dynamic three-dimensional filter pool and a pixel-level filter selection sequence by using a chaotic sequence. 2. And (3) image filling, namely performing asymmetric filling on the image after DNA encryption. 3. Filtering and nonlinear diffusion, namely dynamically selecting a filter for each pixel according to a selection sequence, calculating the weighted sum of three-dimensional neighborhood of the filter, and carrying out no